Showing 10,536 of 10,536 total issues

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

app.factory('CombinedEquipmentMeterService', function ($http) {
    return {
        addPair: function (combinedequipmentID, meterID, metertype, is_output, headers, callback) {
            var meter = {};
            if (metertype == 'meters') {
myems-admin/app/services/settings/equipment/equipmentmeter.service.js on lines 2..38

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

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

angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
  "DATETIME_FORMATS": {
    "AMPMS": [
Severity: Major
Found in myems-admin/js/angular/i18n/angular-locale_id-id.js and 34 other locations - About 2 days to fix
myems-admin/js/angular/i18n/angular-locale_id.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_in.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ja-jp.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ja.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_km-kh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_km.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ko-kp.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ko-kr.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ko.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_lo-la.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_lo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms-bn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms-my.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms-sg.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_my-mm.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_my.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_th-th.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_th.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_vi-vn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_vi.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-cn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-cn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-hk.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-mo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-sg.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant-hk.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant-mo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant-tw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hk.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-tw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh.js on lines 2..125

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

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

angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
  "DATETIME_FORMATS": {
    "AMPMS": [
Severity: Major
Found in myems-admin/js/angular/i18n/angular-locale_ko-kr.js and 34 other locations - About 2 days to fix
myems-admin/js/angular/i18n/angular-locale_id-id.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_id.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_in.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ja-jp.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ja.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_km-kh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_km.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ko-kp.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ko.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_lo-la.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_lo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms-bn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms-my.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms-sg.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ms.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_my-mm.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_my.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_th-th.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_th.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_vi-vn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_vi.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-cn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-cn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-hk.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-mo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans-sg.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hans.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant-hk.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant-mo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant-tw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hant.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-hk.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh-tw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_zh.js on lines 2..125

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

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

          modalInstance.result.then(function(modifiedMicrogridPowerconversionsystem) {
            modifiedMicrogridPowerconversionsystem.run_state_point_id = modifiedMicrogridPowerconversionsystem.run_state_point.id;
            modifiedMicrogridPowerconversionsystem.today_charge_energy_point_id = modifiedMicrogridPowerconversionsystem.today_charge_energy_point.id;
            modifiedMicrogridPowerconversionsystem.today_discharge_energy_point_id = modifiedMicrogridPowerconversionsystem.today_discharge_energy_point.id;
            modifiedMicrogridPowerconversionsystem.total_charge_energy_point_id = modifiedMicrogridPowerconversionsystem.total_charge_energy_point.id;
myems-admin/app/controllers/settings/microgrid/microgridbattery.controller.js on lines 135..163

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

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

          modalInstance.result.then(function(modifiedMicrogridBattery) {
            modifiedMicrogridBattery.battery_state_point_id = modifiedMicrogridBattery.battery_state_point.id;
            modifiedMicrogridBattery.soc_point_id = modifiedMicrogridBattery.soc_point.id;
            modifiedMicrogridBattery.power_point_id = modifiedMicrogridBattery.power_point.id;
            modifiedMicrogridBattery.charge_meter_id = modifiedMicrogridBattery.charge_meter.id;
myems-admin/app/controllers/settings/microgrid/microgridpowerconversionsystem.controller.js on lines 150..179

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

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

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

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

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

Refactorings

Further Reading

Function on_get has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp):
        if 'API-KEY' not in req.headers or \
                not isinstance(req.headers['API-KEY'], str) or \
                len(str.strip(req.headers['API-KEY'])) == 0:
            access_control(req)
Severity: Minor
Found in myems-api/reports/virtualmeterplan.py - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function on_get has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp):
        if 'API-KEY' not in req.headers or \
                not isinstance(req.headers['API-KEY'], str) or \
                len(str.strip(req.headers['API-KEY'])) == 0:
            access_control(req)
Severity: Minor
Found in myems-api/reports/offlinemetersaving.py - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function on_get has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp):
        if 'API-KEY' not in req.headers or \
                not isinstance(req.headers['API-KEY'], str) or \
                len(str.strip(req.headers['API-KEY'])) == 0:
            access_control(req)
Severity: Minor
Found in myems-api/reports/virtualmetersaving.py - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function on_get has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp):
        if 'API-KEY' not in req.headers or \
                not isinstance(req.headers['API-KEY'], str) or \
                len(str.strip(req.headers['API-KEY'])) == 0:
            access_control(req)
Severity: Minor
Found in myems-api/reports/offlinemeterplan.py - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

        result = {"offline_meter": {
            "cost_center_id": offline_meter['cost_center_id'],
            "energy_category_id": offline_meter['energy_category_id'],
            "energy_category_name": offline_meter['energy_category_name'],
            "unit_of_measure": config.currency_unit,
Severity: Major
Found in myems-api/reports/offlinemetercost.py and 1 other location - About 2 days to fix
myems-api/reports/metercost.py on lines 494..521

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

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

        result = {"meter": {
            "cost_center_id": meter['cost_center_id'],
            "energy_category_id": meter['energy_category_id'],
            "energy_category_name": meter['energy_category_name'],
            "unit_of_measure": config.currency_unit,
Severity: Major
Found in myems-api/reports/metercost.py and 1 other location - About 2 days to fix
myems-api/reports/offlinemetercost.py on lines 389..416

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

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

          modalInstance.result.then(function(microgridbattery) {
            microgridbattery.battery_state_point_id = microgridbattery.battery_state_point.id;
            microgridbattery.soc_point_id = microgridbattery.soc_point.id;
            microgridbattery.power_point_id = microgridbattery.power_point.id;
            microgridbattery.charge_meter_id = microgridbattery.charge_meter.id;
myems-admin/app/controllers/settings/microgrid/microgridpowerconversionsystem.controller.js on lines 100..129

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

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

          modalInstance.result.then(function(microgridpowerconversionsystem) {
            microgridpowerconversionsystem.run_state_point_id = microgridpowerconversionsystem.run_state_point.id;
            microgridpowerconversionsystem.today_charge_energy_point_id = microgridpowerconversionsystem.today_charge_energy_point.id;
            microgridpowerconversionsystem.today_discharge_energy_point_id = microgridpowerconversionsystem.today_discharge_energy_point.id;
            microgridpowerconversionsystem.total_charge_energy_point_id = microgridpowerconversionsystem.total_charge_energy_point.id;
myems-admin/app/controllers/settings/microgrid/microgridbattery.controller.js on lines 87..115

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

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 rows is not None and len(rows) > 0:
            for row in rows:
                meta_result = {"id": row[0],
                               "subject": row[1],
                               "message": row[2].replace("<br>", ""),
Severity: Major
Found in myems-api/core/webmessage.py and 1 other location - About 2 days to fix
myems-api/core/webmessage.py on lines 167..178

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

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 rows is not None and len(rows) > 0:
            for row in rows:
                meta_result = {"id": row[0],
                               "subject": row[1],
                               "message": row[2].replace("<br>", ""),
Severity: Major
Found in myems-api/core/webmessage.py and 1 other location - About 2 days to fix
myems-api/core/webmessage.py on lines 271..282

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

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

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

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

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

Refactorings

Further Reading

File combinedequipmentenergycategory.py has 888 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
from core.utilities import get_translation
import os
import re
import uuid
Severity: Major
Found in myems-api/excelexporters/combinedequipmentenergycategory.py - About 2 days to fix

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

            result = {"meter": {
                "cost_center_id": meter['cost_center_id'],
                "energy_category_id": meter['energy_category_id'],
                "energy_category_name": meter['energy_category_name'],
                "unit_of_measure": 'KG',
    Severity: Major
    Found in myems-api/reports/metercarbon.py and 1 other location - About 2 days to fix
    myems-api/reports/offlinemetercarbon.py on lines 389..416

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

    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

            result = {"offline_meter": {
                "cost_center_id": offline_meter['cost_center_id'],
                "energy_category_id": offline_meter['energy_category_id'],
                "energy_category_name": offline_meter['energy_category_name'],
                "unit_of_measure": 'KG',
    Severity: Major
    Found in myems-api/reports/offlinemetercarbon.py and 1 other location - About 2 days to fix
    myems-api/reports/metercarbon.py on lines 495..522

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

    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.deleteSVG=function(svg){
            SweetAlert.swal({
                title: $translate.instant("SWEET.TITLE"),
                text: $translate.instant("SWEET.TEXT"),
                type: "warning",
    Severity: Major
    Found in myems-admin/app/controllers/settings/svg/svg.controller.js and 1 other location - About 2 days to fix
    myems-admin/app/controllers/settings/distributionsystem/distributionsystem.controller.js on lines 123..159

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

    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.deleteDistributionSystem=function(distributionsystem){
            SweetAlert.swal({
                title: $translate.instant("SWEET.TITLE"),
                text: $translate.instant("SWEET.TEXT"),
                type: "warning",
    myems-admin/app/controllers/settings/svg/svg.controller.js on lines 101..137

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

    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