Showing 5,781 of 10,536 total issues

Function on_post has a Cognitive Complexity of 20 (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/combinedequipment.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_put has a Cognitive Complexity of 20 (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:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
Severity: Minor
Found in myems-api/core/equipment.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 20 (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/equipment.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 workingcalendarnonworkingday.controller.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

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

    Function Resolvable has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var Resolvable = /** @class */ (function () {
            function Resolvable(arg1, resolveFn, deps, policy, data) {
                this.resolved = false;
                this.promise = undefined;
                if (arg1 instanceof Resolvable) {
    Severity: Major
    Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

      Function InviteToBoard has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const InviteToBoard = () => {
        const [tooltipText, setTooltipText] = useState('Copy link to invite');
        const [tooltipOpen, setTooltipOpen] = useState(false);
        const tooltipRef = useRef(null);
        const copyTextRef = useRef(null);
      Severity: Major
      Found in myems-web/src/components/kanban/InviteToBoard.js - About 2 hrs to fix

        Function main has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def main():
            """main"""
            # create logger
            logger = logging.getLogger('myems-aggregation')
            # specifies the lowest-severity log message a logger will handle,
        Severity: Major
        Found in myems-aggregation/main.py - About 2 hrs to fix

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

            File contact.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import re
            import uuid
            import falcon
            import mysql.connector
            import simplejson as json
            Severity: Minor
            Found in myems-api/core/contact.py - About 2 hrs to fix

              File MultipleLineChart.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { useState, useContext, useEffect } from 'react';
              import { Row, Col, Card, CardBody } from 'reactstrap';
              import { CheckPicker } from 'rsuite';
              import { rgbaColor, themeColors, isIterableArray, getGrays } from '../../../helpers/utils';
              import AppContext from '../../../context/Context';
              Severity: Minor
              Found in myems-web/src/components/MyEMS/common/MultipleLineChart.js - About 2 hrs to fix

                Function UrlRules has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var UrlRules = /** @class */ (function () {
                        /** @internal */
                        function UrlRules(/** @internal */ router) {
                            this.router = router;
                            /** @internal */ this._sortFn = defaultRuleSortFn;
                Severity: Major
                Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

                  Function groupAnimations has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        function groupAnimations(animations) {
                          var preparedAnimations = [];
                          var refLookup = {};
                          forEach(animations, function(animation, index) {
                            var element = animation.element;
                  Severity: Major
                  Found in myems-admin/js/angular/angular-animate.js - About 2 hrs to fix

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

                            link: function (scope, element, attrs) {
                                var callback, fromParsed, parsedValue, slider, toParsed;
                                slider = $(element);
                                callback = scope.callback ? scope.callback : 'slide';
                                if (scope.ngFrom != null && scope.ngTo != null) {
                    Severity: Major
                    Found in myems-admin/js/plugins/nouslider/angular-nouislider.js - About 2 hrs to fix

                      Function load has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  $delegate.load = function (originalModule) {
                                      var originalParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
                      
                                      var self = this,
                                          config = null,
                      Severity: Major
                      Found in myems-admin/js/plugins/oclazyload/ocLazyLoad.js - About 2 hrs to fix

                        Function loadCarbonData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          const loadCarbonData = () => {
                            let is_logged_in = getCookieValue('is_logged_in');
                            let user_name = getCookieValue('user_name');
                            let user_display_name = getCookieValue('user_display_name');
                            let user_uuid = getCookieValue('user_uuid');

                          Function loadBillingData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            const loadBillingData = () => {
                              let is_logged_in = getCookieValue('is_logged_in');
                              let user_name = getCookieValue('user_name');
                              let user_display_name = getCookieValue('user_display_name');
                              let user_uuid = getCookieValue('user_uuid');

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

                              const handleSubmit = e => {
                                e.preventDefault();
                                console.log('handleSubmit');
                                console.log(moment(reportingPeriodDateRange[0]).format('YYYY-MM-DDTHH:mm:ss'));
                                console.log(moment(reportingPeriodDateRange[1]).format('YYYY-MM-DDTHH:mm:ss'));
                            Severity: Major
                            Found in myems-web/src/components/MyEMS/AdvancedReporting/AdvancedReporting.js - About 2 hrs to fix

                              Function loadEnergyData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                const loadEnergyData = () => {
                                  let is_logged_in = getCookieValue('is_logged_in');
                                  let user_name = getCookieValue('user_name');
                                  let user_display_name = getCookieValue('user_display_name');
                                  let user_uuid = getCookieValue('user_uuid');

                                Function on_post has 67 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 Orders.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import React, { createRef, Fragment, useState } from 'react';
                                  import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
                                  import BootstrapTable from 'react-bootstrap-table-next';
                                  import {
                                    Button,
                                  Severity: Minor
                                  Found in myems-web/src/components/e-commerce/Orders.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language