Showing 5,781 of 10,536 total issues

Function on_get has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def on_get(req, resp):
        access_control(req)
        if 'USER-UUID' not in req.headers or \
                not isinstance(req.headers['USER-UUID'], str) or \
                len(str.strip(req.headers['USER-UUID'])) == 0:
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 on_put has a Cognitive Complexity of 27 (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/textmessage.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

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

'use strict';

app.controller('RuleController', function(
    $scope,
    $rootScope,
Severity: Minor
Found in myems-admin/app/controllers/fdd/rule/rule.controller.js - About 3 hrs to fix

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

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

        File CombinedEquipments.js has 328 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { Fragment, useState, useEffect } from 'react';
        import {
          Breadcrumb,
          BreadcrumbItem,
          Button,
        Severity: Minor
        Found in myems-web/src/components/MyEMS/Monitoring/CombinedEquipments.js - About 3 hrs to fix

          Function addedfile has 96 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  addedfile: function addedfile(file) {
                    var _this2 = this;
          
                    if (this.element === this.previewsContainer) {
                      this.element.classList.add("dz-started");
          Severity: Major
          Found in myems-admin/js/plugins/dropzone/dropzone.js - About 3 hrs to fix

            Function plotLineArea has 96 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        function plotLineArea(datapoints, axisx, axisy) {
                            var points = datapoints.points,
                                ps = datapoints.pointsize,
                                bottom = Math.min(Math.max(0, axisy.min), axisy.max),
                                i = 0, top, areaOpen = false,
            Severity: Major
            Found in myems-admin/js/plugins/flot/jquery.flot.js - About 3 hrs to fix

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

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

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

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

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

                        Function setupTickGeneration has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function setupTickGeneration(axis) {
                                    var opts = axis.options;
                        
                                    // estimate number of ticks
                                    var noTicks;
                        Severity: Major
                        Found in myems-admin/js/plugins/flot/jquery.flot.js - About 3 hrs to fix

                          File initFA.js has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { library } from '@fortawesome/fontawesome-svg-core';
                          import {
                            faFacebook,
                            faFacebookF,
                            faFacebookSquare,
                          Severity: Minor
                          Found in myems-web/src/helpers/initFA.js - About 3 hrs to fix

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

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

                                Function on_put has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def on_put(req, resp, id_, bid):
                                        """Handles PUT requests"""
                                        admin_control(req)
                                        try:
                                            raw_json = req.stream.read().decode('utf-8')
                                Severity: Major
                                Found in myems-api/core/energystoragecontainer.py - About 3 hrs to fix

                                  Function on_post has 95 lines of code (exceeds 25 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: Major
                                  Found in myems-api/core/energystoragecontainer.py - About 3 hrs to fix

                                    Function TzDate has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    angular.mock.TzDate = function(offset, timestamp) {
                                      var self = new Date(0);
                                      if (angular.isString(timestamp)) {
                                        var tsStr = timestamp;
                                    
                                    
                                    Severity: Major
                                    Found in myems-admin/js/angular/angular-mocks.js - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language