Showing 5,781 of 10,536 total issues

Function on_put has a Cognitive Complexity of 21 (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/user.py - About 2 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 21 (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/store.py - About 2 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 combinedequipment.controller.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

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

    File microgriddashboard.py has 287 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/microgriddashboard.py - About 2 hrs to fix

      Function listen has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              this.listen = function () {
                  // bind MouseWheel
                  var s = this, mwTimerStop, mwTimerRelease,
                      mw = function (e) {
                          e.preventDefault();
      Severity: Major
      Found in myems-admin/js/plugins/jsKnob/jquery.knob.js - About 2 hrs to fix

        Function buildSkeleton has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function buildSkeleton() {
                    var headerClass = tm + "-widget-header";
                    var contentClass = tm + "-widget-content";
                    var s;
                    var d;
        Severity: Major
        Found in myems-admin/js/plugins/fullcalendar/fullcalendar.min.js - About 2 hrs to fix

          Function findNearbyItem has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function findNearbyItem(mouseX, mouseY, seriesFilter) {
                      var maxDistance = options.grid.mouseActiveRadius,
                          smallestDistance = maxDistance * maxDistance + 1,
                          item = null, foundPoint = false, i, j, ps;
          
          
          Severity: Major
          Found in myems-admin/js/plugins/flot/jquery.flot.js - About 2 hrs to fix

            Function chart has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            angles.chart = function (type) {
                return {
                    restrict: "A",
                    scope: {
                        data: "=",
            Severity: Major
            Found in myems-admin/js/plugins/chartJs/angles.js - About 2 hrs to fix

              Function nb has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          nb = function(b, c, d, e) {
                            var g =
                              (d && !e) ||
                              (b ? 0 != b[a.options.dataFields.showCheckBox] : !1);
                            if (d && a.options.showExpandBoxes && 1 == a.options.showLines)
              Severity: Major
              Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 2 hrs to fix

                Function beginLoad has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          a.beginLoad = function(a) {
                            if (!va)
                              switch (
                                ((va = !0),
                                a
                Severity: Major
                Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 2 hrs to fix

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

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

                    File MyEMSRoutes.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React from 'react';
                    import { Redirect, Route, Switch } from 'react-router-dom';
                    // import Activity from '../components/page/Activity';
                    // import Associations from '../components/page/Associations';
                    // import Billing from '../components/page/Billing';
                    Severity: Minor
                    Found in myems-web/src/layouts/MyEMSRoutes.js - About 2 hrs to fix

                      Function module has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          return function module(name, requires, configFn) {
                      
                            var info = {};
                      
                            var assertNotHasOwnProperty = function(name, context) {
                      Severity: Major
                      Found in myems-admin/js/angular/angular-loader.js - About 2 hrs to fix

                        Function a has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function a() {
                                var e = this;
                                e.name = "Footable Filter", e.init = function(a) {
                                    if (e.footable = a, a.options.filter.enabled === !0) {
                                        if (t(a.table).data("filter") === !1) return;
                        Severity: Major
                        Found in myems-admin/js/plugins/footable/footable.all.min.js - About 2 hrs to fix

                          Function pathSvgToVml has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          jvm.VMLPathElement.pathSvgToVml = function(path) {
                            var cx = 0, cy = 0, ctrlx, ctrly;
                          
                            path = path.replace(/(-?\d+)e(-?\d+)/g, '0');
                            return path.replace(/([MmLlHhVvCcSs])\s*((?:-?\d*(?:\.\d+)?\s*,?\s*)+)/g, function(segment, letter, coords, index){
                          Severity: Major
                          Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 2 hrs to fix

                            Function b has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                          var b = q(function() {
                                            P = m[0].offsetWidth - 6;
                                            sa = m[0].offsetHeight - 4;
                                            C.css("top", H[0].offsetHeight + 2 + "px");
                                            sa = G ? sa - A[0].offsetHeight : sa - 4;
                            Severity: Major
                            Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 2 hrs to fix

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

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

                                Function generate_excel has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, language):
                                
                                    trans = get_translation(language)
                                    trans.install()
                                    _ = trans.gettext
                                Severity: Major
                                Found in myems-api/excelexporters/energyflowdiagram.py - About 2 hrs to fix

                                  Function on_post has 71 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 2 hrs to fix

                                    File MeterRealtime.js has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import React, { Fragment, useEffect, useState } from 'react';
                                    import {
                                      Breadcrumb,
                                      BreadcrumbItem,
                                      Card,
                                    Severity: Minor
                                    Found in myems-web/src/components/MyEMS/Meter/MeterRealtime.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language