Showing 5,781 of 10,536 total issues

Function $StateRefActiveDirective has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function $StateRefActiveDirective($state, $stateParams, $interpolate, $uiRouter) {
            return {
                restrict: 'A',
                controller: [
                    '$scope',
Severity: Major
Found in myems-admin/js/ui-router/angular-ui-router.js - About 4 hrs to fix

    Function $get has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.$get = ['$injector', '$document', '$timeout', '$rootScope', function ($injector, $document, $timeout, $rootScope) {
          var $animate;
          var $parentSelector = this.parentSelector,
            loadingBarContainer = angular.element(this.loadingBarTemplate),
            loadingBar = loadingBarContainer.find('div').eq(0),
    Severity: Major
    Found in myems-admin/js/plugins/angular-loading-bar/loading-bar.js - About 4 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                    if (a.options.showExpandBoxes) {
                      var d = a.defaultStyle.item.expandBox.general;
                      b[a.options.dataFields.style] &&
                      b[a.options.dataFields.style].expandBox &&
                      b[a.options.dataFields.style].expandBox.general != d
      Severity: Critical
      Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 4 hrs to fix

        Function on_get has 100 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/energystoragepowerstationreportingrevenue.py - About 4 hrs to fix

          Function on_get has 100 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/energystoragepowerstationreportingenergy.py - About 4 hrs to fix

            Function on_get has 100 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/tenantload.py - About 4 hrs to fix

              Function on_get has 100 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/spaceload.py - About 4 hrs to fix

                Function on_get has 100 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/storeload.py - About 4 hrs to fix

                  Function calculateCurvePoints has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function calculateCurvePoints(datapoints, curvedLinesOptions, yPos) {
                  
                              var points = datapoints.points, ps = datapoints.pointsize;
                              var num = curvedLinesOptions.curvePointFactor * (points.length / ps);
                  
                  
                  Severity: Major
                  Found in myems-admin/js/plugins/flot/curvedLines.js - About 3 hrs to fix

                    File energystoragepowerstationcollectionbilling.py has 331 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    from datetime import datetime, timedelta, timezone
                    from decimal import Decimal
                    import falcon
                    import mysql.connector
                    import simplejson as json
                    Severity: Minor
                    Found in myems-api/reports/energystoragepowerstationcollectionbilling.py - About 3 hrs to fix

                      File energystoragepowerstationcollectioncarbon.py has 331 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      from datetime import datetime, timedelta, timezone
                      from decimal import Decimal
                      import falcon
                      import mysql.connector
                      import simplejson as json
                      Severity: Minor
                      Found in myems-api/reports/energystoragepowerstationcollectioncarbon.py - About 3 hrs to fix

                        Function EventCustomField has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const EventCustomField = () => {
                          // State
                          const [name, setName] = useState('');
                          const [type, setType] = useState('text');
                          const [options, setOptions] = useState('');
                        Severity: Major
                        Found in myems-web/src/components/event/EventCustomField.js - About 3 hrs to fix

                          Function on_get has 98 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/shopfloorenergyitem.py - About 3 hrs to fix

                            Function on_get has a Cognitive Complexity of 27 (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/reports/energystoragepowerstationdetailshvac.py - About 3 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 27 (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/reports/energystoragepowerstationdetailsfirecontrol.py - About 3 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 27 (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/reports/energystoragepowerstationdetailsbms.py - About 3 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 27 (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/reports/energystoragepowerstationdetailspcs.py - About 3 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 27 (exceeds 5 allowed). Consider refactoring.
                            Open

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

                                def on_put(req, resp, id_, hid):
                                    """Handles PUT requests"""
                                    admin_control(req)
                                    try:
                                        raw_json = req.stream.read().decode('utf-8')
                            Severity: Minor
                            Found in myems-api/core/energystoragecontainer.py - About 3 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 27 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_get(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_DATA_SOURCE_ID')
                            Severity: Minor
                            Found in myems-api/core/datasource.py - About 3 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

                            Severity
                            Category
                            Status
                            Source
                            Language