Showing 5,781 of 10,536 total issues

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

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

      Function generate_excel has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      def generate_excel(report,
                         name,
                         reporting_start_datetime_local,
                         reporting_end_datetime_local,
                         language):

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

          def on_get(req, resp, id_, lid):
              access_control(req)
              if not id_.isdigit() or int(id_) <= 0:
                  raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                         description='API.INVALID_ENERGY_FLOW_DIAGRAM_ID')
      Severity: Minor
      Found in myems-api/core/energyflowdiagram.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 25 (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/tenant.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 25 (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/energystoragepowerstation.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 25 (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/energystoragepowerstation.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 25 (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/space.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 MockHttpExpectation has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function MockHttpExpectation(expectedMethod, expectedUrl, expectedData, expectedHeaders,
                                   expectedKeys) {
      
        this.data = expectedData;
        this.headers = expectedHeaders;
      Severity: Major
      Found in myems-admin/js/angular/angular-mocks.js - About 3 hrs to fix

        Function link has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    link: function(scope, element, attrs) {
                        function getSettings(el) {
                            var settings = angular.copy(scope.options);
                            settings.element = el;
                            settings.series = scope.series;
        Severity: Major
        Found in myems-admin/js/plugins/rickshaw/angular-rickshaw.js - About 3 hrs to fix

          Function handleRead has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const handleRead = id => {
              console.log('Mark As Read: ', id);
              let isResponseOK = false;
              fetch(APIBaseURL + '/webmessages/' + id, {
                method: 'PUT',
          Severity: Major
          Found in myems-web/src/components/MyEMS/Notification/Notification.js - About 3 hrs to fix

            File tenantbill.py has 315 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/tenantbill.py - About 3 hrs to fix

              File virtualmeterenergy.py has 314 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/virtualmeterenergy.py - About 3 hrs to fix

                Function handledelete has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const handledelete = id => {
                    console.log('Delete: ', id);
                    let isResponseOK = false;
                    fetch(APIBaseURL + '/webmessages/' + id, {
                      method: 'DELETE',
                Severity: Major
                Found in myems-web/src/components/MyEMS/WorkOrder/Repair.js - About 3 hrs to fix

                  Function handledelete has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const handledelete = id => {
                      console.log('Delete: ', id);
                      let isResponseOK = false;
                      fetch(APIBaseURL + '/webmessages/' + id, {
                        method: 'DELETE',
                  Severity: Major
                  Found in myems-web/src/components/MyEMS/WorkOrder/Inspection.js - About 3 hrs to fix

                    Function handledelete has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const handledelete = id => {
                        console.log('Delete: ', id);
                        let isResponseOK = false;
                        fetch(APIBaseURL + '/webmessages/' + id, {
                          method: 'DELETE',
                    Severity: Major
                    Found in myems-web/src/components/MyEMS/WorkOrder/Installation.js - About 3 hrs to fix

                      Function compile has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                      compile: function (tElement, tAttrs, $transclude) {
                                          return function (scope, $element, attrs) {
                                              var onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(), inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';
                                              var previousEl, currentEl, currentScope, viewConfig;
                                              var activeUIView = {
                      Severity: Major
                      Found in myems-admin/js/ui-router/angular-ui-router.js - About 3 hrs to fix

                        Function buildElement has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    $delegate.buildElement = function buildElement(type, path, params) {
                                        var deferred = $q.defer(),
                                            el,
                                            loaded,
                                            filesCache = $delegate._getFilesCache(),
                        Severity: Major
                        Found in myems-admin/js/plugins/oclazyload/ocLazyLoad.js - About 3 hrs to fix

                          Function X has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      X = function(b) {
                                        if (Ha && !va)
                                          switch (b) {
                                            case "start":
                                              Wa(0);
                          Severity: Major
                          Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language