Showing 5,781 of 10,536 total issues

Function on_put has a Cognitive Complexity of 33 (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/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

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

'use strict';

app.controller('EnergyStorageContainerLoadController', function(
    $scope,
    $rootScope,

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

      Function editEnergyStorageContainerGrid has 121 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function UserForm has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const UserForm = () => {
          const { isRTL } = useContext(AppContext);
          const { user, setUser, step, setStep } = useContext(AuthWizardContext);
          const { register, handleSubmit, errors, watch } = useForm();
        
        
        Severity: Major
        Found in myems-web/src/components/auth/wizard/UserForm.js - About 4 hrs to fix

          Function on_post has 121 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 4 hrs to fix

            prototype has 37 functions (exceeds 20 allowed). Consider refactoring.
            Open

            jvm.Map.prototype = {
              transX: 0,
              transY: 0,
              scale: 1,
              baseTransX: 0,
            Severity: Minor
            Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 4 hrs to fix

              File OfflineMeterInput.js has 368 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File energystoragepowerstationcollectionenergy.py has 367 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/energystoragepowerstationcollectionenergy.py - About 4 hrs to fix

                  Function addEnergyStorageContainerGrid has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        $scope.addEnergyStorageContainerGrid = function() {
                  
                            var modalInstance = $uibModal.open({
                                templateUrl: 'views/settings/energystoragecontainer/energystoragecontainergrid.model.html',
                                controller: 'ModalAddEnergyStorageContainerGridCtrl',

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

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

                        Function Sb has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  var Sb = function(b, c) {
                                      var d = a.currentList[b],
                                        g = a.defaultStyle.item.general.normal,
                                        e = a.getCurrentItemStyle(d, a.getObjState(d));
                                      d = '<li class="' + g;
                        Severity: Major
                        Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 4 hrs to fix

                          Function addEnergyStorageContainerLoad has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            Function on_post has a Cognitive Complexity of 32 (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 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 32 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_put(req, resp, id_, gid):
                                    """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 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 118 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/combinedequipmentenergycategory.py - About 4 hrs to fix

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

                                  def on_put(req, resp, id_, pid):
                                      """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 4 hrs to fix

                                Consider simplifying this complex logical expression.
                                Open

                                            if (b)
                                              switch (b.type) {
                                                case "item":
                                                  v &&
                                                    !a.isItemFixed(b) &&
                                Severity: Critical
                                Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - 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_item.py - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language