Showing 5,781 of 10,536 total issues

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

def main(logger):

    while True:
        # the outermost while loop
        ################################################################################################################
Severity: Minor
Found in myems-aggregation/equipment_carbon_input_category.py - About 3 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 process has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring.
Open

def process(logger):

    while True:
        # the outermost loop to reconnect server if there is a connection error
        cnx_historical = None
Severity: Minor
Found in myems-cleaning/clean_energy_value.py - About 3 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 151 (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/equipmentstatistics.py - About 3 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 149 (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/space.py - About 3 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 averaging_hourly_data_by_period has a Cognitive Complexity of 148 (exceeds 5 allowed). Consider refactoring.
Open

def averaging_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetime_utc, period_type):
    # todo: validate parameters
    if start_datetime_utc is None or \
            end_datetime_utc is None or \
            start_datetime_utc >= end_datetime_utc or \
Severity: Minor
Found in myems-api/core/utilities.py - About 3 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 activeUsers.js has 1165 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export const activeUserHistory = [
  183,
  163,
  176,
  172,
Severity: Major
Found in myems-web/src/data/dashboard/activeUsers.js - About 2 days to fix

    Function generate_excel has a Cognitive Complexity of 146 (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/spaceenergyitem.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 145 (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/combinedequipmentoutput.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 app.py has 1149 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import falcon
    from falcon_cors import CORS
    from falcon_multipart.middleware import MultipartMiddleware
    # for debugging this api on Linux or macOS
    from wsgiref import simple_server
    Severity: Major
    Found in myems-api/app.py - About 2 days to fix

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

      def worker(virtual_point):
          cnx_historical_db = None
          cursor_historical_db = None
      
          try:
      Severity: Minor
      Found in myems-normalization/virtualpoint.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 144 (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/metercarbon.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 144 (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/metercost.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 footable.all.min.js has 1114 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * FooTable - Awesome Responsive Tables
       * Version : 2.0.3
       * http://fooplugins.com/plugins/footable-jquery/
       *
      Severity: Major
      Found in myems-admin/js/plugins/footable/footable.all.min.js - About 2 days to fix

        File energystoragepowerstation.py has 1111 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: Major
        Found in myems-api/core/energystoragepowerstation.py - About 2 days to fix

          File chosen.jquery.js has 1109 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*!
           Chosen, a Select Box Enhancer for jQuery and Prototype
           by Patrick Filler for Harvest, http://getharvest.com
          
           Version 1.1.0
          Severity: Major
          Found in myems-admin/js/plugins/chosen/chosen.jquery.js - About 2 days to fix

            Function generate_excel has a Cognitive Complexity of 139 (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/spaceefficiency.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 138 (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/meterenergy.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 IDS_Y has 556 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function IDS_Y(cp) {
              if (0x0041 <= cp && cp <= 0x005A) return true;
              if (0x0061 <= cp && cp <= 0x007A) return true;
              if (cp === 0x00AA) return true;
              if (cp === 0x00B5) return true;
            Severity: Major
            Found in myems-admin/js/angular/angular-parse-ext.js - About 2 days to fix

              Function generate_excel has a Cognitive Complexity of 136 (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/combinedequipmentenergyitem.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 136 (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/equipmentoutput.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

              Severity
              Category
              Status
              Source
              Language