Showing 5,781 of 10,536 total issues

File point.py has 1083 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import falcon
from datetime import datetime, timedelta
import mysql.connector
import simplejson as json
from core.useractivity import user_logger, admin_control
Severity: Major
Found in myems-api/core/point.py - About 2 days to fix

    Function on_get has a Cognitive Complexity of 135 (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/energystoragepowerstationcollectionenergy.py - About 2 days 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 AgendaEventRenderer has 536 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function AgendaEventRenderer() {
            var t = this;
    
    
            // exports
    Severity: Major
    Found in myems-admin/js/plugins/fullcalendar/fullcalendar.min.js - About 2 days to fix

      Function main has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(logger):
      
          while True:
              # the outermost while loop
              ################################################################################################################
      Severity: Minor
      Found in myems-aggregation/meter_billing.py - About 2 days 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 main has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(logger):
      
          while True:
              # the outermost while loop
              ################################################################################################################
      Severity: Minor
      Found in myems-aggregation/meter_carbon.py - About 2 days 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 main has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(logger):
      
          while True:
              # the outermost while loop
              ################################################################################################################
      Severity: Minor
      Found in myems-aggregation/offline_meter_billing.py - About 2 days 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 main has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(logger):
      
          while True:
              # the outermost while loop
              ################################################################################################################
      Severity: Minor
      Found in myems-aggregation/virtual_meter_billing.py - About 2 days 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 main has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(logger):
      
          while True:
              # the outermost while loop
              ################################################################################################################
      Severity: Minor
      Found in myems-aggregation/virtual_meter_carbon.py - About 2 days 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 main has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(logger):
      
          while True:
              # the outermost while loop
              ################################################################################################################
      Severity: Minor
      Found in myems-aggregation/offline_meter_carbon.py - About 2 days 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 131 (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/energystoragepowerstationdetails.py - About 2 days 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 qrcode has 528 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var qrcode = function(typeNumber, errorCorrectionLevel) {
      
          var PAD0 = 0xEC;
          var PAD1 = 0x11;
      
      
      Severity: Major
      Found in myems-admin/js/angular/qrcode.js - About 2 days to fix

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

        def generate_excel(report,
                           name,
                           base_period_start_datetime_local,
                           base_period_end_datetime_local,
                           reporting_start_datetime_local,
        Severity: Minor
        Found in myems-api/excelexporters/storeenergyitem.py - About 2 days 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 129 (exceeds 5 allowed). Consider refactoring.
        Open

        def generate_excel(report,
                           name,
                           base_period_start_datetime_local,
                           base_period_end_datetime_local,
                           reporting_start_datetime_local,
        Severity: Minor
        Found in myems-api/excelexporters/tenantenergyitem.py - About 2 days 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 129 (exceeds 5 allowed). Consider refactoring.
        Open

        def generate_excel(report,
                           name,
                           base_period_start_datetime_local,
                           base_period_end_datetime_local,
                           reporting_start_datetime_local,
        Severity: Minor
        Found in myems-api/excelexporters/shopfloorenergyitem.py - About 2 days 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 127 (exceeds 5 allowed). Consider refactoring.
        Open

        def generate_excel(report,
                           name,
                           base_period_start_datetime_local,
                           base_period_end_datetime_local,
                           reporting_start_datetime_local,
        Severity: Minor
        Found in myems-api/excelexporters/equipmentenergyitem.py - About 2 days 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 126 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_get(req, resp):
                access_control(req)
                # Get user inforamtion
                user_uuid = str.strip(req.headers['USER-UUID'])
                cnx_user_db = mysql.connector.connect(**config.myems_user_db)
        Severity: Minor
        Found in myems-api/reports/microgridlist.py - About 2 days 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 EventManager has 510 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function EventManager(options) { // assumed to be a calendar
            var t = this;
            
            
            // exports
        Severity: Major
        Found in myems-admin/js/plugins/fullcalendar/fullcalendar.js - About 2 days to fix

          Function on_get has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
          Open

              def on_get(req, resp):
                  access_control(req)
                  # Get user inforamtion
                  user_uuid = str.strip(req.headers['USER-UUID'])
                  cnx_user_db = mysql.connector.connect(**config.myems_user_db)
          Severity: Minor
          Found in myems-api/reports/energystoragepowerstationlist.py - About 2 days 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 daterangepicker.js has 1010 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
          * @version: 1.3.21
          * @author: Dan Grossman http://www.dangrossman.info/
          * @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved.
          * @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
          Severity: Major
          Found in myems-admin/js/plugins/daterangepicker/daterangepicker.js - About 2 days to fix

            File EnergyStoragePowerStationDetails.js has 1010 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { Fragment, useState, useEffect } from 'react';
            import {
              Button,
              ButtonGroup,
              Card,
              Severity
              Category
              Status
              Source
              Language