Showing 5,781 of 10,536 total issues

Avoid deeply nested control flow statements.
Open

                    for j in range(len(line.series)):
                        line.series[j].marker.symbol = "circle"
                        line.series[j].smooth = True
                    line.x_axis.crosses = 'min'
Severity: Major
Found in myems-api/excelexporters/combinedequipmentplan.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        for j in range(0, base_period_data_ca_len):
                            current_col_number += 1
                            col = format_cell.get_column_letter(current_col_number)
    
                            ws[col + str(current_row_number)].font = title_font
    Severity: Major
    Found in myems-api/excelexporters/spaceoutput.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for j in range(len(line.series)):
                              line.series[j].marker.symbol = "circle"
                              line.series[j].smooth = True
                          line.x_axis.crosses = 'min'
      Severity: Major
      Found in myems-api/excelexporters/storestatistics.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if has_sub_maximums_data_flag:
                                # line
                                line = LineChart()
                                line.title = _('Base Period Maximum Load') + ' / ' \
                                    + _('Reporting Period Maximum Load') + ' - ' \
        Severity: Major
        Found in myems-api/excelexporters/combinedequipmentload.py - About 45 mins to fix

          Function on_get has a Cognitive Complexity of 8 (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/core/offlinemeterfile.py - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                                  if rows_points is not None and len(rows_points) > 0:
                                      cursor.close()
                                      cnx.close()
                                      raise falcon.HTTPError(status=falcon.HTTP_400, title='API.ERROR',
                                                             description=
          Severity: Major
          Found in myems-api/core/meter.py - About 45 mins to fix

            Function on_get has a Cognitive Complexity of 8 (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/core/energyplanfile.py - About 45 mins 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 8 (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/meter.py - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                    if rows_points is not None and len(rows_points) > 0:
                                        cursor.close()
                                        cnx.close()
                                        raise falcon.HTTPError(status=falcon.HTTP_400, title='API.ERROR',
                                                               description=
            Severity: Major
            Found in myems-api/core/meter.py - About 45 mins to fix

              Function on_post has a Cognitive Complexity of 8 (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/virtualpowerplant.py - About 45 mins 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 8 (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/tenant.py - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def on_get(req, resp, id_):
                      """Handles GET requests"""
                      admin_control(req)
                      if not id_.isdigit() or int(id_) <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
              Severity: Minor
              Found in myems-api/core/rule.py - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def on_get(req, resp, id_):
                      """Handles GET requests"""
                      admin_control(req)
                      if not id_.isdigit() or int(id_) <= 0:
                          raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
              Severity: Minor
              Found in myems-api/core/rule.py - About 45 mins 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 8 (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/tenant.py - About 45 mins 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 8 (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/tenant.py - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def on_post(req, resp, id_):
                      """Handles POST requests"""
                      admin_control(req)
                      try:
                          raw_json = req.stream.read().decode('utf-8')
              Severity: Minor
              Found in myems-api/core/combinedequipment.py - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                                      if numerator_meter is None:
                                          numerator_meter = offline_meter_dict.get(row[5], None)
                                      # find denominator meter by uuid
                                      denominator_meter = meter_dict.get(row[6], None)
              Severity: Major
              Found in myems-api/core/combinedequipment.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if numerator_meter is None:
                                            numerator_meter = offline_meter_dict.get(row[5], None)
                                        # find denominator meter by uuid
                                        denominator_meter = meter_dict.get(row[6], None)
                Severity: Major
                Found in myems-api/core/combinedequipment.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if denominator_meter is None:
                                              denominator_meter = offline_meter_dict.get(row[6], None)
                  
                  
                  Severity: Major
                  Found in myems-api/core/combinedequipment.py - About 45 mins to fix

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

                        def on_post(req, resp, id_):
                            """Handles POST requests"""
                            admin_control(req)
                            try:
                                raw_json = req.stream.read().decode('utf-8')
                    Severity: Minor
                    Found in myems-api/core/combinedequipment.py - About 45 mins 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