Showing 5,781 of 10,536 total issues

File svg.py has 378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import uuid
from datetime import datetime, timedelta
import falcon
import mysql.connector
import simplejson as json
Severity: Minor
Found in myems-api/core/svg.py - About 5 hrs to fix

    File notification.py has 378 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from datetime import datetime, timedelta, timezone
    import falcon
    import mysql.connector
    import simplejson as json
    import config
    Severity: Minor
    Found in myems-api/core/notification.py - About 5 hrs to fix

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

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

        Function gifImage has 126 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var gifImage = function(width, height) {
        
            var _width = width;
            var _height = height;
            var _data = new Array(width * height);
        Severity: Major
        Found in myems-admin/js/angular/qrcode.js - About 5 hrs to fix

          Function _updateFilesUploadProgress has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              value: function _updateFilesUploadProgress(files, xhr, e) {
                var progress;
          
                if (typeof e !== 'undefined') {
                  progress = 100 * e.loaded / e.total;
          Severity: Major
          Found in myems-admin/js/plugins/dropzone/dropzone.js - About 5 hrs to fix

            Function Sidepanel has 126 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Sidepanel = () => {
              const { toggleModal } = useContext(AppContext);
              return (
                <Fragment>
                  <PageHeader
            Severity: Major
            Found in myems-web/src/components/bootstrap-components/Sidepanel.js - About 5 hrs to fix

              File angular-sanitize.js has 376 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-sanitize.js - About 5 hrs to fix

                Function on_get has 125 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/shopfloorenergycategory.py - About 5 hrs to fix

                  File timezones.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  export default [
                    {
                      offset: 'GMT-12:00',
                      name: 'Etc/GMT-12'
                    },
                  Severity: Minor
                  Found in myems-web/src/data/event/timezones.js - About 5 hrs to fix

                    Function $ViewDirective has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q) {
                                function getRenderer() {
                                    return {
                                        enter: function (element, target, cb) {
                                            if (ng.version.minor > 2) {
                    Severity: Major
                    Found in myems-admin/js/ui-router/angular-ui-router.js - About 4 hrs to fix

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

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

                          File metersubmetersbalance.py has 373 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import base64
                          from core.utilities import get_translation
                          import os
                          import re
                          import uuid
                          Severity: Minor
                          Found in myems-api/excelexporters/metersubmetersbalance.py - About 4 hrs to fix

                            Function SettingsAccount has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const SettingsAccount = () => {
                              // State
                              const [viewProfile, setViewProfile] = useState('view-everyone');
                              const [tagSetting, setTagSetting] = useState('tag-off');
                              const [showFollowers, setShowFollowers] = useState(true);
                            Severity: Major
                            Found in myems-web/src/components/Settings/SettingsAccount.js - About 4 hrs to fix

                              Function on_get has a Cognitive Complexity of 33 (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/reports/energystoragepowerstationdetailsschedule.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 33 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def on_put(req, resp):
                                      """Handles PUT requests"""
                                      access_control(req)
                                      try:
                                          raw_json = req.stream.read().decode('utf-8')
                              Severity: Minor
                              Found in myems-api/core/webmessage.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 33 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def on_get(req, resp, id_):
                                      """Handles GET requests"""
                                      access_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/webmessage.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_delete has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def on_delete(req, resp, id_):
                                      access_control(req)
                                      if not id_.isdigit() or int(id_) <= 0:
                                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                                 description='API.INVALID_WEB_MESSAGE_ID')
                              Severity: Minor
                              Found in myems-api/core/webmessage.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 33 (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/point.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 33 (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/point.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

                              Severity
                              Category
                              Status
                              Source
                              Language