Showing 10,536 of 10,536 total issues

Function main has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    """main"""
    # create logger
    logger = logging.getLogger('myems-aggregation')
    # specifies the lowest-severity log message a logger will handle,
Severity: Minor
Found in myems-aggregation/main.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

    $scope.add = function() {
        var variable = {
            name: 'x' + ($scope.counter),
            meter_type: $scope.currentMeterType.selected.sid,
            meter_id: $scope.currentMeter.selected.id,
myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 406..427

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

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

          <DropdownItem tag="div" className="text-base px-3 py-2">
            <span className="d-flex justify-content-between fs--1 text-black">
              <span className="font-weight-semi-bold">Extended License</span>
              <span>$99.00</span>
            </span>
Severity: Major
Found in myems-web/src/components/page/Billing.js and 1 other location - About 1 day to fix
myems-web/src/components/page/Billing.js on lines 42..60

Duplicated Code

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

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

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

Tuning

This issue has a mass of 223.

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.add = function() {
        var variable = {
            name: 'x' + ($scope.counter),
            meter_type: $scope.currentMeterType.selected.sid,
            meter_id: $scope.currentMeter.selected.id,
myems-admin/app/controllers/settings/meter/virtualmeter.controller.js on lines 538..558

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

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

          <DropdownItem tag="div" className="text-base px-3 py-2">
            <span className="d-flex justify-content-between fs--1 text-black">
              <span className="font-weight-semi-bold">Standard License</span>
              <span>$59.00</span>
            </span>
Severity: Major
Found in myems-web/src/components/page/Billing.js and 1 other location - About 1 day to fix
myems-web/src/components/page/Billing.js on lines 62..80

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

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

      this.callDragOver = function(a) {
        return angular.isDefined(c.events) && c.events.dragOver
          ? c.events.dragOver({
              event: a.event,
              sourceTree: a.sourceTree,
Severity: Major
Found in myems-admin/js/jcui/angular.integralui.treeview.min.js and 1 other location - About 1 day to fix
myems-admin/js/jcui/angular.integralui.treeview.min.js on lines 1488..1512

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

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

      this.callDragDrop = function(a) {
        return angular.isDefined(c.events) && c.events.dragDrop
          ? c.events.dragDrop({
              event: a.event,
              sourceTree: a.sourceTree,
Severity: Major
Found in myems-admin/js/jcui/angular.integralui.treeview.min.js and 1 other location - About 1 day to fix
myems-admin/js/jcui/angular.integralui.treeview.min.js on lines 1463..1487

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

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

Consider simplifying this complex logical expression.
Open

                if (u) {
                  var l = a && (a.shiftKey || a.ctrlKey || a.metaKey) ? !0 : !1;
                  u = !0;
                  "multi-extended" === b.options.selectionMode &&
                    (u = !b.isObjInSelList(h) || !l || D || (a && a.shiftKey));
Severity: Critical
Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 1 day to fix

    File combinedequipmentcarbon.py has 555 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import re
    from datetime import datetime, timedelta, timezone
    from decimal import Decimal
    import gettext
    import falcon
    Severity: Major
    Found in myems-api/reports/combinedequipmentcarbon.py - About 1 day to fix

      File advancedreport.py has 555 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import uuid
      from datetime import datetime, timezone, timedelta
      import falcon
      import mysql.connector
      import simplejson as json
      Severity: Major
      Found in myems-api/core/advancedreport.py - About 1 day to fix

        File clockpicker.js has 554 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!
         * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
         * Copyright 2014 Wang Shenwei.
         * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
         */
        Severity: Major
        Found in myems-admin/js/plugins/clockpicker/clockpicker.js - About 1 day to fix

          Function StateService has 232 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var StateService = /** @class */ (function () {
                  /** @internal */
                  function StateService(/** @internal */ router) {
                      this.router = router;
                      /** @internal */
          Severity: Major
          Found in myems-admin/js/ui-router/angular-ui-router.js - About 1 day to fix

            Function on_put has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
            Open

                def on_put(req, resp, id_):
                    """Handles PUT requests"""
                    admin_control(req)
                    try:
                        raw_json = req.stream.read().decode('utf-8')
            Severity: Minor
            Found in myems-api/core/virtualmeter.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

                    if rows_offline_meters is not None and len(rows_offline_meters) > 0:
                        add_values = (" INSERT INTO tbl_combined_equipments_offline_meters "
                                      " (combined_equipment_id, offline_meter_id, is_output) "
                                      " VALUES  ")
                        for row in rows_offline_meters:
            Severity: Major
            Found in myems-api/core/combinedequipment.py and 1 other location - About 1 day to fix
            myems-api/core/equipment.py on lines 545..554

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

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

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

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

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

            Refactorings

            Further Reading

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

                    if rows_offline_meters is not None and len(rows_offline_meters) > 0:
                        add_values = (" INSERT INTO tbl_equipments_offline_meters (equipment_id, offline_meter_id, is_output) "
                                      " VALUES  ")
                        for row in rows_offline_meters:
                            add_values += " (" + str(new_id) + ","
            Severity: Major
            Found in myems-api/core/equipment.py and 1 other location - About 1 day to fix
            myems-api/core/combinedequipment.py on lines 522..532

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

            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 spacecarbon.py has 552 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import re
            from datetime import datetime, timedelta, timezone
            from decimal import Decimal
            import falcon
            import mysql.connector
            Severity: Major
            Found in myems-api/reports/spacecarbon.py - About 1 day to fix

              File spacecost.py has 552 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import re
              from datetime import datetime, timedelta, timezone
              from decimal import Decimal
              import falcon
              import mysql.connector
              Severity: Major
              Found in myems-api/reports/spacecost.py - About 1 day to fix

                Function $$AnimateJsProvider has 230 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var $$AnimateJsProvider = ['$animateProvider', /** @this */ function($animateProvider) {
                  this.$get = ['$injector', '$$AnimateRunner', '$$jqLite',
                       function($injector,   $$AnimateRunner,   $$jqLite) {
                
                    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
                Severity: Major
                Found in myems-admin/js/angular/angular-animate.js - About 1 day to fix

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

                                EnergyFlowDiagramNodeService.addEnergyFlowDiagramNode(energyflowdiagramid, energyflowdiagramnode, headers, function (response) {
                                    if (angular.isDefined(response.status) && response.status === 201) {
                                        toaster.pop({
                                            type: "success",
                                            title: $translate.instant("TOASTER.SUCCESS_TITLE"),
                  myems-admin/app/controllers/settings/energyflowdiagram/energyflowdiagramlink.controller.js on lines 96..114

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

                  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

                              EnergyFlowDiagramLinkService.addEnergyFlowDiagramLink(energyflowdiagramid, energyflowdiagramlink, headers, function (response) {
                                  if (angular.isDefined(response.status) && response.status === 201) {
                                      toaster.pop({
                                          type: "success",
                                          title: $translate.instant("TOASTER.SUCCESS_TITLE"),
                  myems-admin/app/controllers/settings/energyflowdiagram/energyflowdiagramnode.controller.js on lines 62..80

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

                  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