Showing 5,781 of 10,536 total issues

Avoid deeply nested control flow statements.
Open

                    if common_start_datetime_utc < min(energy_hourly.keys()):
                        common_start_datetime_utc = min(energy_hourly.keys())
                    if common_end_datetime_utc > max(energy_hourly.keys()):
Severity: Major
Found in myems-aggregation/combined_equipment_energy_input_item.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if common_start_datetime_utc < min(energy_hourly.keys()):
                            common_start_datetime_utc = min(energy_hourly.keys())
                        if common_end_datetime_utc > max(energy_hourly.keys()):
    Severity: Major
    Found in myems-aggregation/combined_equipment_energy_input_item.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for energy_category_id in energy_category_list:
                              current_tariff = tariff_dict[energy_category_id].get(current_datetime_utc)
                              current_energy = energy_dict[current_datetime_utc].get(energy_category_id)
                              if current_tariff is not None \
                                      and isinstance(current_tariff, Decimal) \
      Severity: Major
      Found in myems-aggregation/tenant_billing_input_category.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if current_datetime_utc not in energy_shopfloor_hourly[shopfloor_id]:
                                    energy_shopfloor_hourly[shopfloor_id][current_datetime_utc] = dict()
                                energy_category_id = row_energy_value[1]
        Severity: Major
        Found in myems-aggregation/space_energy_input_category.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if common_start_datetime_utc < min(energy_hourly.keys()):
                                  common_start_datetime_utc = min(energy_hourly.keys())
                              if common_end_datetime_utc > max(energy_hourly.keys()):
          Severity: Major
          Found in myems-aggregation/equipment_energy_input_category.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if len(billing_dict[current_datetime_utc]) == 0:
                                    del billing_dict[current_datetime_utc]
            
                        ############################################################################################################
                        # Step 6: save billing data to billing database
            Severity: Major
            Found in myems-aggregation/tenant_billing_input_category.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if common_start_datetime_utc < min(energy_hourly.keys()):
                                      common_start_datetime_utc = min(energy_hourly.keys())
                                  if common_end_datetime_utc > max(energy_hourly.keys()):
              Severity: Major
              Found in myems-aggregation/space_energy_input_category.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for energy_category_id in energy_category_list:
                                            current_billing = billing_dict[current_datetime_utc].get(energy_category_id)
                                            if current_billing is not None and isinstance(current_billing, Decimal):
                                                add_values += " (" + str(tenant['id']) + ","
                                                add_values += " " + str(energy_category_id) + ","
                Severity: Major
                Found in myems-aggregation/tenant_billing_input_category.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          for energy_category_id, actual_value in meta_data_dict.items():
                                              aggregated_value['meta_data'][energy_category_id] = \
                                                  aggregated_value['meta_data'].get(energy_category_id, Decimal(0.0)) + actual_value
                  
                  
                  Severity: Major
                  Found in myems-aggregation/space_energy_input_category.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if common_end_datetime_utc > max(energy_hourly.keys()):
                                            common_end_datetime_utc = max(energy_hourly.keys())
                    
                    
                    Severity: Major
                    Found in myems-aggregation/space_energy_input_category.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if common_end_datetime_utc > max(energy_hourly.keys()):
                                              common_end_datetime_utc = max(energy_hourly.keys())
                      
                      
                      Severity: Major
                      Found in myems-aggregation/space_energy_output_category.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if common_start_datetime_utc < min(energy_hourly.keys()):
                                                common_start_datetime_utc = min(energy_hourly.keys())
                                            if common_end_datetime_utc > max(energy_hourly.keys()):
                        Severity: Major
                        Found in myems-aggregation/space_energy_input_category.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  for energy_category_id, actual_value in meta_data_dict.items():
                                                      aggregated_value['meta_data'][energy_category_id] = \
                                                          aggregated_value['meta_data'].get(energy_category_id, Decimal(0.0)) + actual_value
                          
                          
                          Severity: Major
                          Found in myems-aggregation/space_energy_input_category.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    for energy_category_id, actual_value in meta_data_dict.items():
                                                        aggregated_value['meta_data'][energy_category_id] = \
                                                            aggregated_value['meta_data'].get(energy_category_id, Decimal(0.0)) + actual_value
                            
                            
                            Severity: Major
                            Found in myems-aggregation/space_energy_output_category.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      while current_datetime_local < rows[index + 1][0].replace(tzinfo=timezone.utc) + \
                                                              timedelta(minutes=timezone_offset):
                                                          point_timestamps.append(current_datetime_local.strftime('%m-%d %H:%M'))
                                                          point_values.append(rows[index][1])
                                                          current_datetime_local += timedelta(minutes=1)
                              Severity: Major
                              Found in myems-api/reports/energystoragepowerstationdetails.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if Decimal(-999999999999999.999) <= Decimal(value) <= Decimal(999999999999999.999):
                                                        energy_value_list.append({'point_id': point['id'],
                                                                                  'is_trend': point['is_trend'],
                                                                                  'value': Decimal(value) * point['ratio'] + point['offset_constant']})
                                                elif point['object_type'] == 'DIGITAL_VALUE':
                                Severity: Major
                                Found in myems-modbus-tcp/acquisition.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          for row in rows:
                                                              current_datetime_local = row[0].replace(tzinfo=timezone.utc) + \
                                                                                       timedelta(minutes=timezone_offset)
                                                              current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S')
                                                              point_timestamps.append(current_datetime)
                                  Severity: Major
                                  Found in myems-api/reports/spacesaving.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            for row in rows:
                                                                current_datetime_local = row[0].replace(tzinfo=timezone.utc) + \
                                                                                         timedelta(minutes=timezone_offset)
                                                                current_datetime = current_datetime_local.strftime('%Y-%m-%dT%H:%M:%S')
                                                                point_timestamps.append(current_datetime)
                                    Severity: Major
                                    Found in myems-api/reports/spacesaving.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if current_datetime_utc not in energy_equipment_hourly[equipment_id]:
                                                                  energy_equipment_hourly[equipment_id][current_datetime_utc] = dict()
                                                              energy_category_id = row_value[1]
                                      Severity: Major
                                      Found in myems-aggregation/space_energy_output_category.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            if common_end_datetime_utc > max(energy_hourly.keys()):
                                                                common_end_datetime_utc = max(energy_hourly.keys())
                                        
                                        
                                        Severity: Major
                                        Found in myems-aggregation/energy_storage_power_station_energy_discharge.py - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language