Showing 5,781 of 10,536 total issues

Function on_get has 131 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/energystoragepowerstationitemenergy.py - About 5 hrs to fix

    Function on_get has 131 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/energystoragepowerstationitemcarbon.py - About 5 hrs to fix

      Function on_get has 131 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/energystoragepowerstationitembilling.py - About 5 hrs to fix

        File energystoragecontainerhvac.controller.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        app.controller('EnergyStorageContainerHVACController', function(
            $scope,
            $rootScope,

          File textmessage.py has 384 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from datetime import datetime, timedelta, timezone
          import falcon
          import mysql.connector
          import simplejson as json
          from core.useractivity import user_logger, admin_control
          Severity: Minor
          Found in myems-api/core/textmessage.py - About 5 hrs to fix

            Function Header has 130 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function Header(calendar, options) {
                    var t = this;
            
            
                    // exports
            Severity: Major
            Found in myems-admin/js/plugins/fullcalendar/fullcalendar.min.js - About 5 hrs to fix

              Function generate_excel has 130 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/spacestatistics.py - About 5 hrs to fix

                Function TransitionService has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var TransitionService = /** @class */ (function () {
                        /** @internal */
                        function TransitionService(_router) {
                            /** @internal */
                            this._transitionCount = 0;
                Severity: Major
                Found in myems-admin/js/ui-router/angular-ui-router.js - About 5 hrs to fix

                  File space.controller.js has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  'use strict';
                  
                  app.controller('SpaceController', function (
                      $scope,
                      $rootScope,
                  Severity: Minor
                  Found in myems-admin/app/controllers/settings/space/space.controller.js - About 5 hrs to fix

                    File energystoragepowerstationreportingparameters.py has 380 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: Minor
                    Found in myems-api/reports/energystoragepowerstationreportingparameters.py - About 5 hrs to fix

                      Function generate_excel has 128 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/tenantstatistics.py - About 5 hrs to fix

                        Function on_get has a Cognitive Complexity of 34 (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/energystoragepowerstationitemdashboard.py - About 5 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 get_energy_category_tariffs has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_energy_category_tariffs(cost_center_id, energy_category_id, start_datetime_utc, end_datetime_utc):
                            # todo: verify parameters
                            if cost_center_id is None:
                                return dict()
                        
                        
                        Severity: Minor
                        Found in myems-aggregation/tariff.py - About 5 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 get_energy_item_tariffs has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_energy_item_tariffs(cost_center_id, energy_item_id, start_datetime_utc, end_datetime_utc):
                            # todo: verify parameters
                            if cost_center_id is None:
                                return dict()
                        
                        
                        Severity: Minor
                        Found in myems-aggregation/tariff.py - About 5 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 get_energy_category_tariffs has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_energy_category_tariffs(cost_center_id, energy_category_id, start_datetime_utc, end_datetime_utc):
                            # todo: validate parameters
                            if cost_center_id is None:
                                return dict()
                        
                        
                        Severity: Minor
                        Found in myems-api/core/utilities.py - About 5 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 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_put(req, resp, id_):
                                """Handles PUT requests"""
                                access_control(req)
                                try:
                                    raw_json = req.stream.read().decode('utf-8')
                        Severity: Minor
                        Found in myems-api/core/webmessage.py - About 5 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 get_energy_category_peak_types has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_energy_category_peak_types(cost_center_id, energy_category_id, start_datetime_utc, end_datetime_utc):
                            # todo: validate parameters
                            if cost_center_id is None:
                                return dict()
                        
                        
                        Severity: Minor
                        Found in myems-api/core/utilities.py - About 5 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 user_logger has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def user_logger(func):
                            """
                            Decorator for logging user activities
                            :param func: the decorated function
                            :return: the decorator
                        Severity: Minor
                        Found in myems-api/core/useractivity.py - About 5 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 34 (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/point.py - About 5 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 Main has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const Main = props => {
                          const [isFluid, setIsFluid] = useState(getItemFromStore('isFluid', settings.isFluid));
                          const [isRTL, setIsRTL] = useState(getItemFromStore('isRTL', settings.isRTL));
                          const [isDark, setIsDark] = useState(getItemFromStore('isDark', settings.isDark));
                          const [isTopNav, setIsTopNav] = useState(getItemFromStore('isTopNav', settings.isTopNav));
                        Severity: Major
                        Found in myems-web/src/Main.js - About 5 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language