Showing 5,781 of 10,536 total issues

File tenantenergyitem.py has 505 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: Major
Found in myems-api/reports/tenantenergyitem.py - About 1 day to fix

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

        def on_post(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/distributionsystem.py - About 1 day 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 QRRSBlock has 202 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var QRRSBlock = function() {
    
        var RS_BLOCK_TABLE = [
    
          // L
    Severity: Major
    Found in myems-admin/js/angular/qrcode.js - About 1 day to fix

      Function on_get has a Cognitive Complexity of 51 (exceeds 5 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: Minor
      Found in myems-api/reports/enterproduction.py - About 7 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 51 (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/virtualmeter.py - About 7 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 51 (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/virtualmeter.py - About 7 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 Dashboard.js has 496 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { Fragment, useEffect, useState, useContext } from 'react';
      import CountUp from 'react-countup';
      import { Col, Row, Spinner, Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
      import EnergyStoragePowerStationTableCard from './EnergyStoragePowerStationTableCard';
      import CardSummary from '../common/CardSummary';
      Severity: Minor
      Found in myems-web/src/components/MyEMS/EnergyStoragePowerStation/Dashboard.js - About 7 hrs to fix

        File CollectionDashboard.js has 496 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { Fragment, useEffect, useState, useContext } from 'react';
        import CountUp from 'react-countup';
        import { Col, Row, Spinner, Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
        import EnergyStoragePowerStationTableCard from './EnergyStoragePowerStationTableCard';
        import CardSummary from '../common/CardSummary';

          File equipmentenergyitem.py has 496 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/equipmentenergyitem.py - About 7 hrs to fix

            File distributioncircuit.py has 496 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import uuid
            import falcon
            import mysql.connector
            import simplejson as json
            from core.useractivity import user_logger, admin_control, access_control, api_key_control
            Severity: Minor
            Found in myems-api/core/distributioncircuit.py - About 7 hrs to fix

              File equipmentcost.py has 494 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/equipmentcost.py - About 7 hrs to fix

                File metersaving.py has 494 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/metersaving.py - About 7 hrs to fix

                  File meterplan.py has 494 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/meterplan.py - About 7 hrs to fix

                    File equipmentcarbon.py has 494 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/equipmentcarbon.py - About 7 hrs to fix

                      File Dashboard.js has 490 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { Fragment, useEffect, useState, useContext } from 'react';
                      import CountUp from 'react-countup';
                      import { Col, Row, Spinner, Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
                      import MicrogridTableCard from './MicrogridTableCard';
                      import CardSummary from '../common/CardSummary';
                      Severity: Minor
                      Found in myems-web/src/components/MyEMS/Microgrid/Dashboard.js - About 7 hrs to fix

                        Function generate_excel has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def generate_excel(report,
                                           name,
                                           reporting_start_datetime_local,
                                           reporting_end_datetime_local,
                                           period_type,
                        Severity: Minor
                        Found in myems-api/excelexporters/tenantbill.py - About 7 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 generate_excel has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
                        
                            trans = get_translation(language)
                            trans.install()
                            _ = trans.gettext
                        Severity: Minor
                        Found in myems-api/excelexporters/metersubmetersbalance.py - About 7 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 49 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def on_post(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/virtualmeter.py - About 7 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 energystoragepowerstationreportingrevenue.py has 479 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/energystoragepowerstationreportingrevenue.py - About 7 hrs to fix

                          Function $$AnimateCssDriverProvider has 187 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var $$AnimateCssDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) {
                            $$animationProvider.drivers.push('$$animateCssDriver');
                          
                            var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim';
                            var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor';
                          Severity: Major
                          Found in myems-admin/js/angular/angular-animate.js - About 7 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language