Showing 10,536 of 10,536 total issues

Similar blocks of code found in 30 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_ar-sa.js and 29 other locations - About 2 days to fix
myems-admin/js/angular/i18n/angular-locale_ar-001.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ae.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-bh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dj.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dz.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-eg.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-eh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-er.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-il.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-iq.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-jo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-km.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-kw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-lb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ly.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ma.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-mr.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-om.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ps.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-qa.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sd.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-so.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ss.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sy.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-td.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-tn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-xb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ye.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar.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 509.

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 30 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_ar-eg.js and 29 other locations - About 2 days to fix
myems-admin/js/angular/i18n/angular-locale_ar-001.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ae.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-bh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dj.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dz.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-eh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-er.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-il.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-iq.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-jo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-km.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-kw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-lb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ly.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ma.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-mr.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-om.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ps.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-qa.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sa.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sd.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-so.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ss.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sy.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-td.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-tn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-xb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ye.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar.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 509.

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 30 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_ar-qa.js and 29 other locations - About 2 days to fix
myems-admin/js/angular/i18n/angular-locale_ar-001.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ae.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-bh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dj.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dz.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-eg.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-eh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-er.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-il.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-iq.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-jo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-km.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-kw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-lb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ly.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ma.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-mr.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-om.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ps.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sa.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sd.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-so.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ss.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sy.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-td.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-tn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-xb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ye.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar.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 509.

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 30 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_ar-ma.js and 29 other locations - About 2 days to fix
myems-admin/js/angular/i18n/angular-locale_ar-001.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ae.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-bh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dj.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-dz.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-eg.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-eh.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-er.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-il.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-iq.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-jo.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-km.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-kw.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-lb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ly.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-mr.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-om.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ps.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-qa.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sa.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sd.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-so.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ss.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-sy.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-td.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-tn.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-xb.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar-ye.js on lines 2..125
myems-admin/js/angular/i18n/angular-locale_ar.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 509.

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 generate_excel has a Cognitive Complexity of 145 (exceeds 5 allowed). Consider refactoring.
Open

def generate_excel(report,
                   name,
                   base_period_start_datetime_local,
                   base_period_end_datetime_local,
                   reporting_start_datetime_local,
Severity: Minor
Found in myems-api/excelexporters/combinedequipmentoutput.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

File app.py has 1149 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import falcon
from falcon_cors import CORS
from falcon_multipart.middleware import MultipartMiddleware
# for debugging this api on Linux or macOS
from wsgiref import simple_server
Severity: Major
Found in myems-api/app.py - About 2 days to fix

    Function worker has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring.
    Open

    def worker(virtual_point):
        cnx_historical_db = None
        cursor_historical_db = None
    
        try:
    Severity: Minor
    Found in myems-normalization/virtualpoint.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 144 (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/metercarbon.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 144 (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/metercost.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 3 locations. Consider refactoring.
    Open

    app.factory('DataRepairFileService', function($http) {  
        return {  
            getAllDataRepairFiles:function(headers, callback){
                $http.get(getAPI()+'datarepairfiles', {headers})  
                .then(function (response) {
    myems-admin/app/services/settings/energyplanfile/energyplanfile.service.js on lines 2..53
    myems-admin/app/services/settings/meter/offlinemeterfile.service.js on lines 2..53

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

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

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

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

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

    Refactorings

    Further Reading

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

    app.factory('EnergyPlanFileService', function($http) {  
        return {  
            getAllEnergyPlanFiles:function(headers, callback){
                $http.get(getAPI()+'energyplanfiles', {headers})  
                .then(function (response) {
    myems-admin/app/services/settings/datasource/datarepairfile.service.js on lines 2..53
    myems-admin/app/services/settings/meter/offlinemeterfile.service.js on lines 2..53

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

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

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

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

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

    Refactorings

    Further Reading

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

    app.factory('OfflineMeterFileService', function($http) {  
        return {  
            getAllOfflineMeterFiles:function(headers, callback){
                $http.get(getAPI()+'offlinemeterfiles', {headers})  
                .then(function (response) {
    myems-admin/app/services/settings/datasource/datarepairfile.service.js on lines 2..53
    myems-admin/app/services/settings/energyplanfile/energyplanfile.service.js on lines 2..53

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

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

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

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

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

    Refactorings

    Further Reading

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

        @staticmethod
        @user_logger
        def on_delete(req, resp, id_, pid):
            admin_control(req)
            if not id_.isdigit() or int(id_) <= 0:
    Severity: Major
    Found in myems-api/core/equipment.py and 3 other locations - About 2 days to fix
    myems-api/core/combinedequipment.py on lines 1238..1284
    myems-api/core/energyflowdiagram.py on lines 748..794
    myems-api/core/energyflowdiagram.py on lines 1109..1155

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

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

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

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

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

    Refactorings

    Further Reading

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

        @staticmethod
        @user_logger
        def on_delete(req, resp, id_, lid):
            admin_control(req)
            if not id_.isdigit() or int(id_) <= 0:
    Severity: Major
    Found in myems-api/core/energyflowdiagram.py and 3 other locations - About 2 days to fix
    myems-api/core/combinedequipment.py on lines 1238..1284
    myems-api/core/energyflowdiagram.py on lines 1109..1155
    myems-api/core/equipment.py on lines 1069..1115

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

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

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

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

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

    Refactorings

    Further Reading

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

        @staticmethod
        @user_logger
        def on_delete(req, resp, id_, nid):
            admin_control(req)
            if not id_.isdigit() or int(id_) <= 0:
    Severity: Major
    Found in myems-api/core/energyflowdiagram.py and 3 other locations - About 2 days to fix
    myems-api/core/combinedequipment.py on lines 1238..1284
    myems-api/core/energyflowdiagram.py on lines 748..794
    myems-api/core/equipment.py on lines 1069..1115

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

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

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

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

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

    Refactorings

    Further Reading

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

        @staticmethod
        @user_logger
        def on_delete(req, resp, id_, pid):
            admin_control(req)
            if not id_.isdigit() or int(id_) <= 0:
    Severity: Major
    Found in myems-api/core/combinedequipment.py and 3 other locations - About 2 days to fix
    myems-api/core/energyflowdiagram.py on lines 748..794
    myems-api/core/energyflowdiagram.py on lines 1109..1155
    myems-api/core/equipment.py on lines 1069..1115

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

    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

                    meta_result = {"id": row[0],
                                   "name": row[1],
                                   "uuid": row[2],
                                   "power_point": point_dict.get(row[3]),
                                   "buy_meter": meter_dict.get(row[4]),
    Severity: Major
    Found in myems-api/core/energystoragecontainer.py and 1 other location - About 2 days to fix
    myems-api/core/energystoragecontainer.py on lines 3998..4024

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

    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 row is None:
                raise falcon.HTTPError(status=falcon.HTTP_404, title='API.NOT_FOUND',
                                       description='API.ENERGY_STORAGE_CONTAINER_LOAD_NOT_FOUND')
            else:
                meta_result = {"id": row[0],
    Severity: Major
    Found in myems-api/core/energystoragecontainer.py and 1 other location - About 2 days to fix
    myems-api/core/energystoragecontainer.py on lines 2158..2180

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

    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_schedules is None or len(rows_schedules) == 0:
                pass
            else:
                for row_schedule in rows_schedules:
                    start_time = row_schedule[0]
    Severity: Major
    Found in myems-api/reports/microgriddetails.py and 1 other location - About 2 days to fix
    myems-api/reports/energystoragepowerstationdetailsschedule.py on lines 104..132

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

    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_schedules is None or len(rows_schedules) == 0:
                pass
            else:
                for row_schedule in rows_schedules:
                    start_time = row_schedule[0]
    Severity: Major
    Found in myems-api/reports/energystoragepowerstationdetailsschedule.py and 1 other location - About 2 days to fix
    myems-api/reports/microgriddetails.py on lines 599..627

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

    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