Showing 5,781 of 10,536 total issues

Consider simplifying this complex logical expression.
Open

    if (energy_meter_hourly is None or len(energy_meter_hourly) == 0) and \
            (energy_virtual_meter_hourly is None or len(energy_virtual_meter_hourly) == 0) and \
            (energy_offline_meter_hourly is None or len(energy_offline_meter_hourly) == 0) and \
            (energy_combined_equipment_hourly is None or len(energy_combined_equipment_hourly) == 0) and \
            (energy_equipment_hourly is None or len(energy_equipment_hourly) == 0) and \
Severity: Critical
Found in myems-aggregation/space_energy_input_item.py - About 4 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (meter_list is None or len(meter_list) == 0) and \
                (virtual_meter_list is None or len(virtual_meter_list) == 0) and \
                (offline_meter_list is None or len(offline_meter_list) == 0) and \
                (combined_equipment_list is None or len(combined_equipment_list) == 0) and \
                (equipment_list is None or len(equipment_list) == 0) and \
    Severity: Critical
    Found in myems-aggregation/space_energy_input_category.py - About 4 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if (energy_meter_hourly is None or len(energy_meter_hourly) == 0) and \
                  (energy_virtual_meter_hourly is None or len(energy_virtual_meter_hourly) == 0) and \
                  (energy_offline_meter_hourly is None or len(energy_offline_meter_hourly) == 0) and \
                  (energy_combined_equipment_hourly is None or len(energy_combined_equipment_hourly) == 0) and \
                  (energy_equipment_hourly is None or len(energy_equipment_hourly) == 0) and \
      Severity: Critical
      Found in myems-aggregation/space_energy_input_category.py - About 4 hrs to fix

        File BillingUserForm.js has 360 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { Fragment, useContext } from 'react';
        import WizardInput from './WizardInput';
        import { Col, Row, UncontrolledTooltip } from 'reactstrap';
        import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
        import { AuthWizardContext } from '../../../context/Context';
        Severity: Minor
        Found in myems-web/src/components/auth/wizard/BillingUserForm.js - About 4 hrs to fix

          Function generate_excel has 116 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def generate_excel(report,
                             name,
                             base_period_start_datetime_local,
                             base_period_end_datetime_local,
                             reporting_start_datetime_local,
          Severity: Major
          Found in myems-api/excelexporters/shopfloorstatistics.py - About 4 hrs to fix

            Function generate_excel has 116 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def generate_excel(report,
                               name,
                               base_period_start_datetime_local,
                               base_period_end_datetime_local,
                               reporting_start_datetime_local,
            Severity: Major
            Found in myems-api/excelexporters/storestatistics.py - About 4 hrs to fix

              Function Trace has 115 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var Trace = /** @class */ (function () {
                      /** @internal */
                      function Trace() {
                          /** @internal */
                          this._enabled = {};
              Severity: Major
              Found in myems-admin/js/ui-router/angular-ui-router.js - About 4 hrs to fix

                Function renderSection has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function renderSection(position) {
                        var sectionEl = $('<div class="fc-' + position + '"/>');
                        var buttonStr = options.header[position];
                
                        if (buttonStr) {
                Severity: Major
                Found in myems-admin/js/plugins/fullcalendar/fullcalendar.js - About 4 hrs to fix

                  Function editEnergyStorageContainerLoad has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        $scope.editEnergyStorageContainerLoad = function(energystoragecontainerload) {
                            var modalInstance = $uibModal.open({
                                templateUrl: 'views/settings/energystoragecontainer/energystoragecontainerload.model.html',
                                controller: 'ModalEditEnergyStorageContainerLoadCtrl',
                              windowClass: "animated fadeIn",

                    Function on_get has 115 lines of code (exceeds 25 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: Major
                    Found in myems-api/reports/metersaving.py - About 4 hrs to fix

                      Function on_get has 115 lines of code (exceeds 25 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: Major
                      Found in myems-api/reports/meterplan.py - About 4 hrs to fix

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

                        def main():
                            """main"""
                            # create logger
                            logger = logging.getLogger('myems-modbus-tcp')
                            # specifies the lowest-severity log message a logger will handle,
                        Severity: Minor
                        Found in myems-modbus-tcp/main.py - About 4 hrs 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_post has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_post(req, resp):
                                """Handles POST requests"""
                                admin_control(req)
                                try:
                                    raw_json = req.stream.read().decode('utf-8')
                        Severity: Minor
                        Found in myems-api/core/distributionsystem.py - About 4 hrs 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 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_get(req, resp, id_):
                                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/core/energyflowdiagram.py - About 4 hrs 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_put has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_put(req, resp, id_, lid):
                                """Handles PUT requests"""
                                admin_control(req)
                                if not id_.isdigit() or int(id_) <= 0:
                                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                        Severity: Minor
                        Found in myems-api/core/energyflowdiagram.py - About 4 hrs 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_put has a Cognitive Complexity of 31 (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/offlinemeter.py - About 4 hrs 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_put has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_put(req, resp, id_):
                                """Handles PUT requests"""
                                admin_control(req)
                        
                                if not id_.isdigit() or int(id_) <= 0:
                        Severity: Minor
                        Found in myems-api/core/wechatmessage.py - About 4 hrs 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_delete has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_delete(req, resp, id_):
                                admin_control(req)
                                if not id_.isdigit() or int(id_) <= 0:
                                    raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                           description='API.INVALID_NOTIFICATION_ID')
                        Severity: Minor
                        Found in myems-api/core/notification.py - About 4 hrs 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 CanvasRenderer has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            var CanvasRenderer = function(el, options) {
                                var cachedBackground;
                                var canvas = document.createElement('canvas');
                        
                                el.appendChild(canvas);
                        Severity: Major
                        Found in myems-admin/js/plugins/easypiechart/easypiechart.js - About 4 hrs to fix

                          Function CanvasRenderer has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var CanvasRenderer = function(el, options) {
                                  var cachedBackground;
                                  var canvas = document.createElement('canvas');
                          
                                  el.appendChild(canvas);
                          Severity: Major
                          Found in myems-admin/js/plugins/easypiechart/angular.easypiechart.js - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language