Showing 5,781 of 10,536 total issues

Function on_get has a Cognitive Complexity of 99 (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/microgridscarbon.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 on_get has a Cognitive Complexity of 99 (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/energystoragepowerstationcollectioncarbon.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 on_get has a Cognitive Complexity of 99 (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/microgridsenergy.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 on_get has a Cognitive Complexity of 99 (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/equipment.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 worker has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
Open

def worker(energy_storage_power_station):
    cnx_system_db = None
    cursor_system_db = None
    try:
        cnx_system_db = mysql.connector.connect(**config.myems_system_db)
Severity: Minor
Found in myems-aggregation/energy_storage_power_station_energy_charge.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 worker has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
Open

def worker(energy_storage_power_station):
    cnx_system_db = None
    cursor_system_db = None
    try:
        cnx_system_db = mysql.connector.connect(**config.myems_system_db)
Severity: Minor
Found in myems-aggregation/energy_storage_power_station_energy_discharge.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

File shopfloorcarbon.py has 822 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
from core.utilities import get_translation
import os
import re
import uuid
Severity: Major
Found in myems-api/excelexporters/shopfloorcarbon.py - About 1 day to fix

    File shopfloorcost.py has 821 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import base64
    from core.utilities import get_translation
    import os
    import re
    import uuid
    Severity: Major
    Found in myems-api/excelexporters/shopfloorcost.py - About 1 day to fix

      File Fault.js has 818 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { createRef, Fragment, useEffect, useState } from 'react';
      import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
      import BootstrapTable from 'react-bootstrap-table-next';
      import { toast } from 'react-toastify';
      import {
      Severity: Major
      Found in myems-web/src/components/MyEMS/FDD/Fault.js - About 1 day to fix

        File spacesaving.py has 817 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import base64
        from core.utilities import get_translation
        import os
        import uuid
        from decimal import Decimal
        Severity: Major
        Found in myems-api/excelexporters/spacesaving.py - About 1 day to fix

          File spaceplan.py has 817 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import base64
          from core.utilities import get_translation
          import os
          import uuid
          from decimal import Decimal
          Severity: Major
          Found in myems-api/excelexporters/spaceplan.py - About 1 day to fix

            File combinedequipmentefficiency.py has 816 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/combinedequipmentefficiency.py - About 1 day to fix

              File spaceincome.py has 813 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import base64
              from core.utilities import get_translation
              import os
              import re
              import uuid
              Severity: Major
              Found in myems-api/excelexporters/spaceincome.py - About 1 day to fix

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

                def generate_excel(report, name1, name2, 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/metercomparison.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

                File jquery.validate.min.js has 802 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                (function () {
                    "use strict";
                    angular.module("app.chart.ctrls", []).controller("chartCtrl", ["$scope", function ($scope) {
                        return $scope.easypiechart = {percent: 65, options: {animate: {duration: 1e3, enabled: !0}, barColor: "#31C0BE", lineCap: "round", size: 180, lineWidth: 5}}, $scope.easypiechart2 = {percent: 35, options: {animate: {duration: 1e3, enabled: !0}, barColor: "#66B5D7", lineCap: "round", size: 180, lineWidth: 10}}, $scope.easypiechart3 = {percent: 68, options: {animate: {duration: 1e3, enabled: !0}, barColor: "#60CD9B", lineCap: "square", size: 180, lineWidth: 20, scaleLength: 0}}, $scope.gaugeChart1 = {data: {maxValue: 3e3, animationSpeed: 40, val: 1375}, options: {lines: 12, angle: 0, lineWidth: .47, pointer: {length: .6, strokeWidth: .03, color: "#000000"}, limitMax: "false", colorStart: "#A3C86D", colorStop: "#A3C86D", strokeColor: "#E0E0E0", generateGradient: !0, percentColors: [
                            [0, "#60CD9B"],
                Severity: Major
                Found in myems-admin/js/plugins/validate/jquery.validate.min.js - About 1 day to fix

                  Function worker has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def worker(microgrid):
                      ####################################################################################################################
                      # Step 1: get all discharge meters associated with the microgrid
                      ####################################################################################################################
                      print("Step 1: get all discharge meters associated with the microgrid " + str(microgrid['name']))
                  Severity: Minor
                  Found in myems-aggregation/microgrid_energy_discharge.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 worker has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def worker(energy_storage_container):
                      ####################################################################################################################
                      # Step 1: get all charge meters associated with the energy storage container
                      ####################################################################################################################
                      print("Step 1: get all charge meters associated with the energy storage container " +
                  Severity: Minor
                  Found in myems-aggregation/energy_storage_container_energy_charge.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 worker has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def worker(microgrid):
                      ####################################################################################################################
                      # Step 1: get all charge meters associated with the microgrid
                      ####################################################################################################################
                      print("Step 1: get all charge meters associated with the microgrid " + str(microgrid['name']))
                  Severity: Minor
                  Found in myems-aggregation/microgrid_energy_charge.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 worker has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def worker(energy_storage_container):
                      ####################################################################################################################
                      # Step 1: get all discharge meters associated with the energy storage container
                      ####################################################################################################################
                      print("Step 1: get all discharge meters associated with the energy storage container " +
                  Severity: Minor
                  Found in myems-aggregation/energy_storage_container_energy_discharge.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 on_get has a Cognitive Complexity of 94 (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/energyflowdiagram.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

                  Severity
                  Category
                  Status
                  Source
                  Language