Showing 5,781 of 10,536 total issues

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

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

      Function draggableSlotEvent has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function draggableSlotEvent(event, eventElement, timeElement) {
                  var coordinateGrid = t.getCoordinateGrid();
                  var colCnt = getColCnt();
                  var colWidth = getColWidth();
                  var snapHeight = getSnapHeight();
      Severity: Major
      Found in myems-admin/js/plugins/fullcalendar/fullcalendar.min.js - About 4 hrs to fix

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

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

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

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

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

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

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

                        def on_post(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: Minor
                    Found in myems-api/reports/enterproduction.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 a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def on_get(req, resp, id_):
                            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: Minor
                    Found in myems-api/core/meter.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_post has a Cognitive Complexity of 29 (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/offlinemeter.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 29 (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/emailmessage.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_post has a Cognitive Complexity of 29 (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/offlinemeter.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 a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def on_get(req, resp, id_):
                            """Handles GET requests"""
                            if 'API-KEY' not in req.headers or \
                                    not isinstance(req.headers['API-KEY'], str) or \
                                    len(str.strip(req.headers['API-KEY'])) == 0:
                    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

                    Function updateViewSize has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              a.updateViewSize = function() {
                                var b = q(function() {
                                  Q = 0;
                                  F = G = !1;
                                  a.getTemplateUrl() || a.updateLongestItem();
                    Severity: Major
                    Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 4 hrs to fix

                      Function componentDidMount has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        componentDidMount() {
                          this._isMounted = true;
                          const { t } = this.props;
                          // fetch meter realtime data at the first time
                          let isResponseOK = false;
                      Severity: Major
                      Found in myems-web/src/components/MyEMS/Space/RealtimeData.js - About 4 hrs to fix

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

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

                          'use strict';
                          
                          app.controller('TenantController', function (
                              $scope,
                              $rootScope,
                          Severity: Minor
                          Found in myems-admin/app/controllers/settings/tenant/tenant.controller.js - About 4 hrs to fix

                            File Cards.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { Fragment } from 'react';
                            import { Button, Card, CardBody, Col, Row } from 'reactstrap';
                            import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
                            import PageHeader from '../common/PageHeader';
                            import FalconCardHeader from '../common/FalconCardHeader';
                            Severity: Minor
                            Found in myems-web/src/components/bootstrap-components/Cards.js - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language