Showing 5,781 of 10,536 total issues

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

def main():
    global g_mqtt_connected_flag
    mqc = None
    try:
        mqc = mqtt.Client(callback_api_version=mqtt.CallbackAPIVersion.VERSION2,
Severity: Minor
Found in myems-api/test_mqtt.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 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/equipmentload.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        for j in range(0, 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/spacesaving.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/combinedequipmentsaving.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/equipmentcost.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              for j in range(0, reporting_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/spaceincome.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/shopfloorplan.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if has_sub_maximums_data_flag:
                                      current_col_number += 1
                                      col = format_cell.get_column_letter(current_col_number)
              
                                      ws[col + str(current_row_number)].fill = table_fill
              Severity: Major
              Found in myems-api/excelexporters/tenantload.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/storeplan.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/spaceincome.py - About 45 mins to fix

                    Function export has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
                    Severity: Minor
                    Found in myems-api/excelexporters/energystoragepowerstationreportingrevenue.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/spacestatistics.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/spacestatistics.py - About 45 mins to fix

                          Function export has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def export(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
                          Severity: Minor
                          Found in myems-api/excelexporters/energystoragepowerstationreportingenergy.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if has_sub_averages_data_flag:
                                                    current_col_number += 1
                                                    col = format_cell.get_column_letter(current_col_number)
                                                    ws[col + str(current_row_number)].fill = table_fill
                                                    ws[col + str(current_row_number)].font = title_font
                            Severity: Major
                            Found in myems-api/excelexporters/tenantload.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if has_sub_averages_data_flag:
                                                      # line
                                                      line = LineChart()
                                                      line.title = _('Base Period Average Load') + ' / ' \
                                                          + _('Reporting Period Average Load') + ' - ' \
                              Severity: Major
                              Found in myems-api/excelexporters/tenantload.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/tenantcost.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if has_sub_averages_data_flag:
                                                          current_col_number += 1
                                                          col = format_cell.get_column_letter(current_col_number)
                                  
                                                          ws[col + str(current_row_number)].fill = table_fill
                                  Severity: Major
                                  Found in myems-api/excelexporters/tenantload.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        for j in range(0, reporting_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/storeplan.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          for j in range(0, 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/spaceincome.py - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language