Showing 5,781 of 10,536 total issues

Function on_post has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def on_post(req, resp):
        """Handles POST requests"""
        admin_control(req)

        try:
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 microgrid.controller.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

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

    File Typography.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Fragment } from 'react';
    import { Card, CardHeader, CardBody, Row, Col } from 'reactstrap';
    import PageHeader from '../common/PageHeader';
    import FalconEditor from '../common/FalconEditor';
    import FalconCardHeader from '../common/FalconCardHeader';
    Severity: Minor
    Found in myems-web/src/components/utilities/Typography.js - About 3 hrs to fix

      Function draggableDayEvent has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function draggableDayEvent(event, eventElement, seg) {
                  var isStart = seg.isStart;
                  var origWidth;
                  var revert;
                  var allDay = true;
      Severity: Major
      Found in myems-admin/js/plugins/fullcalendar/fullcalendar.min.js - About 3 hrs to fix

        Function handledelete has 85 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/Notification/Notification.js - About 3 hrs to fix

          Function handleCodeSubmit has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const handleCodeSubmit = e => {
              setIsDisabled(true);
              let isResponseOK = false;
              e.preventDefault();
              let subject = 'Forgot Password';

            Function Avatars has 85 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Avatars = () => {
              return (
                <Fragment>
                  <PageHeader
                    title="Avatar"
            Severity: Major
            Found in myems-web/src/components/bootstrap-components/Avatar.js - About 3 hrs to fix

              Function handleSubmit has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const handleSubmit = e => {
                  e.preventDefault();
                  console.log('handleSubmit');
                  console.log(priority);
                  console.log(status);
              Severity: Major
              Found in myems-web/src/components/MyEMS/WorkOrder/Inspection.js - About 3 hrs to fix

                Function handleSubmit has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const handleSubmit = e => {
                    e.preventDefault();
                    console.log('handleSubmit');
                    console.log(priority);
                    console.log(status);
                Severity: Major
                Found in myems-web/src/components/MyEMS/WorkOrder/Repair.js - About 3 hrs to fix

                  Function handleSubmit has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const handleSubmit = e => {
                      e.preventDefault();
                      console.log('handleSubmit');
                      console.log(priority);
                      console.log(status);
                  Severity: Major
                  Found in myems-web/src/components/MyEMS/WorkOrder/Installation.js - About 3 hrs to fix

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

                      File angular-resource.js has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * @license AngularJS v1.8.3
                       * (c) 2010-2020 Google LLC. http://angularjs.org
                       * License: MIT
                       */
                      Severity: Minor
                      Found in myems-admin/js/angular/angular-resource.js - About 3 hrs to fix

                        File jquery.flot.time.js has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /* Pretty handling of time axes.
                        
                        Copyright (c) 2007-2014 IOLA and Ole Laursen.
                        Licensed under the MIT license.
                        
                        
                        Severity: Minor
                        Found in myems-admin/js/plugins/flot/jquery.flot.time.js - About 3 hrs to fix

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

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

                            Function getOption has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const getOption = (data, isDark) => {
                              const grays = getGrays(isDark);
                              return {
                                tooltip: {
                                  triggerOn: 'mousemove',
                            Severity: Major
                            Found in myems-web/src/components/dashboard-alt/TotalOrder.js - About 3 hrs to fix

                              Function setupModuleLoader has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function setupModuleLoader(window) {
                              
                                var $injectorMinErr = minErr('$injector');
                                var ngMinErr = minErr('ng');
                              
                              
                              Severity: Major
                              Found in myems-admin/js/angular/angular-loader.js - About 3 hrs to fix

                                File orders.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import {v4 as uuid} from 'uuid';
                                
                                const result = [
                                  {
                                    id: uuid().split('-')[0],
                                Severity: Minor
                                Found in myems-web/src/data/e-commerce/orders.js - About 3 hrs to fix

                                  Function handledelete has 82 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/FDD/Fault.js - About 3 hrs to fix

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

                                      Function getElements has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      Dropzone.getElements = function (els, name) {
                                        var el, elements;
                                      
                                        if (els instanceof Array) {
                                          elements = [];
                                      Severity: Minor
                                      Found in myems-admin/js/plugins/dropzone/dropzone.js - 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