Showing 10,536 of 10,536 total issues

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

        if energy_item_set is not None and len(energy_item_set) > 0:
            for energy_item_id in energy_item_set:
                child_space_data[energy_item_id] = dict()
                child_space_data[energy_item_id]['child_space_names'] = list()
                child_space_data[energy_item_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/spaceenergyitem.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentcost.py on lines 520..542
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceincome.py on lines 507..528
myems-api/reports/spaceoutput.py on lines 507..528

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

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

        if energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                child_space_data[energy_category_id] = dict()
                child_space_data[energy_category_id]['child_space_names'] = list()
                child_space_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/spaceincome.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentcost.py on lines 520..542
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceoutput.py on lines 507..528

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

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_):
        admin_control(req)
        if not id_.isdigit() or int(id_) <= 0:
Severity: Major
Found in myems-api/core/wechatmessage.py and 3 other locations - About 1 day to fix
myems-api/core/emailmessage.py on lines 457..489
myems-api/core/textmessage.py on lines 426..456
myems-api/core/user.py on lines 1519..1551

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

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

        if energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                associated_equipment_data[energy_category_id] = dict()
                associated_equipment_data[energy_category_id]['associated_equipment_names'] = list()
                associated_equipment_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/combinedequipmentcost.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spacecost.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceincome.py on lines 507..528
myems-api/reports/spaceoutput.py on lines 507..528

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

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

        if energy_category_set is not None and len(energy_category_set) > 0:
            for energy_category_id in energy_category_set:
                child_space_data[energy_category_id] = dict()
                child_space_data[energy_category_id]['child_space_names'] = list()
                child_space_data[energy_category_id]['subtotals'] = list()
Severity: Major
Found in myems-api/reports/spacecost.py and 11 other locations - About 1 day to fix
myems-api/reports/combinedequipmentcarbon.py on lines 530..552
myems-api/reports/combinedequipmentcost.py on lines 520..542
myems-api/reports/combinedequipmentefficiency.py on lines 773..795
myems-api/reports/combinedequipmentenergyitem.py on lines 523..545
myems-api/reports/combinedequipmentincome.py on lines 500..522
myems-api/reports/combinedequipmentoutput.py on lines 500..523
myems-api/reports/combinedequipmentstatistics.py on lines 526..548
myems-api/reports/spacecarbon.py on lines 526..547
myems-api/reports/spaceenergyitem.py on lines 531..553
myems-api/reports/spaceincome.py on lines 507..528
myems-api/reports/spaceoutput.py on lines 507..528

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

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 95 (exceeds 5 allowed). Consider refactoring.
Open

def generate_excel(report, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type,
                   language):
    trans = get_translation(language)
    trans.install()
    _ = trans.gettext
Severity: Minor
Found in myems-api/excelexporters/metercomparison.py - About 1 day 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

app.factory('CostFileService', function($http) {
    return {
        getAllCostFiles:function(headers, callback){
            $http.get(getAPI()+'costfiles', {headers})
            .then(function (response) {
myems-admin/app/services/settings/knowledgefile/knowledgefile.service.js on lines 2..40

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

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

app.factory('KnowledgeFileService', function ($http) {
    return {
        getAllKnowledgeFiles: function (headers, callback) {
            $http.get(getAPI() + 'knowledgefiles', {headers})
            .then(function (response) {
myems-admin/app/services/settings/costcenter/costfile.service.js on lines 2..37

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

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 jquery.validate.min.js has 802 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function () {
    "use strict";
    angular.module("app.chart.ctrls", []).controller("chartCtrl", ["$scope", function ($scope) {
        return $scope.easypiechart = {percent: 65, options: {animate: {duration: 1e3, enabled: !0}, barColor: "#31C0BE", lineCap: "round", size: 180, lineWidth: 5}}, $scope.easypiechart2 = {percent: 35, options: {animate: {duration: 1e3, enabled: !0}, barColor: "#66B5D7", lineCap: "round", size: 180, lineWidth: 10}}, $scope.easypiechart3 = {percent: 68, options: {animate: {duration: 1e3, enabled: !0}, barColor: "#60CD9B", lineCap: "square", size: 180, lineWidth: 20, scaleLength: 0}}, $scope.gaugeChart1 = {data: {maxValue: 3e3, animationSpeed: 40, val: 1375}, options: {lines: 12, angle: 0, lineWidth: .47, pointer: {length: .6, strokeWidth: .03, color: "#000000"}, limitMax: "false", colorStart: "#A3C86D", colorStop: "#A3C86D", strokeColor: "#E0E0E0", generateGradient: !0, percentColors: [
            [0, "#60CD9B"],
Severity: Major
Found in myems-admin/js/plugins/validate/jquery.validate.min.js - About 1 day to fix

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

        $scope.importMeter = function() {
            var modalInstance = $uibModal.open({
                templateUrl: 'views/common/import.html',
                controller: 'ModalImportCtrl',
                windowClass: "animated fadeIn",
    myems-admin/app/controllers/settings/datasource/datasource.controller.js on lines 226..262
    myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 252..288
    myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 280..316
    myems-admin/app/controllers/settings/space/space.controller.js on lines 331..367
    myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 259..295

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 338.

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

        $scope.importSpace = function() {
            var modalInstance = $uibModal.open({
                templateUrl: 'views/common/import.html',
                controller: 'ModalImportCtrl',
                windowClass: "animated fadeIn",
    myems-admin/app/controllers/settings/datasource/datasource.controller.js on lines 226..262
    myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 252..288
    myems-admin/app/controllers/settings/meter/meter.controller.js on lines 337..373
    myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 280..316
    myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 259..295

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 338.

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

        $scope.importDataSource = function() {
            var modalInstance = $uibModal.open({
                templateUrl: 'views/common/import.html',
                controller: 'ModalImportCtrl',
                windowClass: "animated fadeIn",
    myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 252..288
    myems-admin/app/controllers/settings/meter/meter.controller.js on lines 337..373
    myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 280..316
    myems-admin/app/controllers/settings/space/space.controller.js on lines 331..367
    myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 259..295

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 338.

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

        $scope.importVirtualMeter = function() {
            var modalInstance = $uibModal.open({
                templateUrl: 'views/common/import.html',
                controller: 'ModalImportCtrl',
                windowClass: "animated fadeIn",
    myems-admin/app/controllers/settings/datasource/datasource.controller.js on lines 226..262
    myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 252..288
    myems-admin/app/controllers/settings/meter/meter.controller.js on lines 337..373
    myems-admin/app/controllers/settings/space/space.controller.js on lines 331..367
    myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 259..295

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 338.

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

        $scope.importEnergyStoragePowerStation = function() {
            var modalInstance = $uibModal.open({
                templateUrl: 'views/common/import.html',
                controller: 'ModalImportCtrl',
                windowClass: "animated fadeIn",
    myems-admin/app/controllers/settings/datasource/datasource.controller.js on lines 226..262
    myems-admin/app/controllers/settings/meter/meter.controller.js on lines 337..373
    myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 280..316
    myems-admin/app/controllers/settings/space/space.controller.js on lines 331..367
    myems-admin/app/controllers/settings/tenant/tenant.controller.js on lines 259..295

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 338.

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

        $scope.importTenant = function() {
            var modalInstance = $uibModal.open({
                templateUrl: 'views/common/import.html',
                controller: 'ModalImportCtrl',
                windowClass: "animated fadeIn",
    myems-admin/app/controllers/settings/datasource/datasource.controller.js on lines 226..262
    myems-admin/app/controllers/settings/energystoragepowerstation/energystoragepowerstation.controller.js on lines 252..288
    myems-admin/app/controllers/settings/meter/meter.controller.js on lines 337..373
    myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 280..316
    myems-admin/app/controllers/settings/space/space.controller.js on lines 331..367

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

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

    def worker(microgrid):
        ####################################################################################################################
        # Step 1: get all discharge meters associated with the microgrid
        ####################################################################################################################
        print("Step 1: get all discharge meters associated with the microgrid " + str(microgrid['name']))
    Severity: Minor
    Found in myems-aggregation/microgrid_energy_discharge.py - About 1 day 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 worker has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
    Open

    def worker(energy_storage_container):
        ####################################################################################################################
        # Step 1: get all charge meters associated with the energy storage container
        ####################################################################################################################
        print("Step 1: get all charge meters associated with the energy storage container " +
    Severity: Minor
    Found in myems-aggregation/energy_storage_container_energy_charge.py - About 1 day 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 worker has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
    Open

    def worker(microgrid):
        ####################################################################################################################
        # Step 1: get all charge meters associated with the microgrid
        ####################################################################################################################
        print("Step 1: get all charge meters associated with the microgrid " + str(microgrid['name']))
    Severity: Minor
    Found in myems-aggregation/microgrid_energy_charge.py - About 1 day 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 worker has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
    Open

    def worker(energy_storage_container):
        ####################################################################################################################
        # Step 1: get all discharge meters associated with the energy storage container
        ####################################################################################################################
        print("Step 1: get all discharge meters associated with the energy storage container " +
    Severity: Minor
    Found in myems-aggregation/energy_storage_container_energy_discharge.py - About 1 day 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 94 (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/energyflowdiagram.py - About 1 day 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

    Severity
    Category
    Status
    Source
    Language