Showing 5,594 of 10,115 total issues

File jquery-jvectormap-2.0.2.min.js has 2497 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * jVectorMap version 2.0.2
 *
 * Copyright 2011-2014, Kirill Lebedev
 *
Severity: Major
Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 6 days to fix

    File store.py has 2426 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/store.py - About 6 days to fix

      Function on_post has a Cognitive Complexity of 325 (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/space.py - About 6 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 321 (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/combinedequipmentefficiency.py - About 6 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 angular-animate.js has 2271 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: Major
      Found in myems-admin/js/angular/angular-animate.js - About 6 days to fix

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

            def on_post(req, resp, id_):
                """Handles POST requests"""
                if 'API-KEY' not in req.headers or \
                        not isinstance(req.headers['API-KEY'], str) or \
                        len(str.strip(req.headers['API-KEY'])) == 0:
        Severity: Minor
        Found in myems-api/core/combinedequipment.py - About 6 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 jquery.flot.js has 2239 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* Javascript plotting library for jQuery, version 0.8.3.
        
        Copyright (c) 2007-2014 IOLA and Ole Laursen.
        Licensed under the MIT license.
        
        
        Severity: Major
        Found in myems-admin/js/plugins/flot/jquery.flot.js - About 6 days to fix

          Function on_get has a Cognitive Complexity of 299 (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/spaceefficiency.py - About 6 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 298 (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/tenantload.py - About 6 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 298 (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/spaceload.py - About 6 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 292 (exceeds 5 allowed). Consider refactoring.
          Open

              def on_get(req, resp):
                  # todo: change this procedure from space to store
                  if 'API-KEY' not in req.headers or \
                          not isinstance(req.headers['API-KEY'], str) or \
                          len(str.strip(req.headers['API-KEY'])) == 0:
          Severity: Minor
          Found in myems-api/reports/storedashboard.py - About 6 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 292 (exceeds 5 allowed). Consider refactoring.
          Open

              def on_get(req, resp):
                  # todo: change this procedure from space to shopfloor
                  if 'API-KEY' not in req.headers or \
                          not isinstance(req.headers['API-KEY'], str) or \
                          len(str.strip(req.headers['API-KEY'])) == 0:
          Severity: Minor
          Found in myems-api/reports/shopfloordashboard.py - About 6 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 292 (exceeds 5 allowed). Consider refactoring.
          Open

              def on_get(req, resp):
                  # todo: change this procedure from space to tenant
                  if 'API-KEY' not in req.headers or \
                          not isinstance(req.headers['API-KEY'], str) or \
                          len(str.strip(req.headers['API-KEY'])) == 0:
          Severity: Minor
          Found in myems-api/reports/tenantdashboard.py - About 6 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 292 (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/dashboard.py - About 6 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 worker has a Cognitive Complexity of 290 (exceeds 5 allowed). Consider refactoring.
          Open

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

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

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

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

          def worker(combined_equipment):
              ####################################################################################################################
              # Step 1: get all input meters associated with the combined equipment
              ####################################################################################################################
              print("Step 1: get all input meters associated with the combined equipment " + str(combined_equipment['name']))
          Severity: Minor
          Found in myems-aggregation/combined_equipment_energy_input_category.py - About 5 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 286 (exceeds 5 allowed). Consider refactoring.
          Open

          def process(logger, data_source_id, host, port, interval_in_seconds):
              while True:
                  # begin of the outermost while loop
          
                  ################################################################################################################
          Severity: Minor
          Found in myems-modbus-tcp/acquisition.py - About 5 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