Showing 5,781 of 10,536 total issues

Avoid deeply nested control flow statements.
Open

                        if analog_value_latest_dict.get(row_point[0]) is not None:
                            battery_soc_point_value = analog_value_latest_dict.get(row_point[0])['actual_value']
                            battery_power_point_value = analog_value_latest_dict.get(row_point[1])['actual_value']

                # get photovoltaic power point
Severity: Major
Found in myems-api/reports/microgridlist.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/spaceenvironmentmonitor.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/tenantcost.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/equipmentload.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/spacecarbon.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

                                      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/equipmentcost.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if digital_value_latest_dict.get(row_point[0]) is not None:
                                            battery_state_point_value = digital_value_latest_dict.get(row_point[0])['actual_value']
                
                                # 0: 无电池, No Battery
                                # 1: 故障, Fault
                Severity: Major
                Found in myems-api/reports/microgridlist.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if current_datetime_utc not in energy_combined_equipment_hourly[combined_equipment_id]:
                                              energy_combined_equipment_hourly[combined_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 Decimal(-999999999999999.999) <= Decimal(value) <= Decimal(999999999999999.999):
                                            analog_value_list.append({'point_id': point['id'],
                                                                      'is_trend': point['is_trend'],
                                                                      'value': Decimal(value) * point['ratio'] + point['offset_constant']})
                                    elif point['object_type'] == 'ENERGY_VALUE':
                    Severity: Major
                    Found in myems-modbus-tcp/acquisition.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if point_value['is_trend']:
                                              add_values += " (" + str(point_value['point_id']) + ","
                                              add_values += "'" + current_datetime_utc.isoformat() + "',"
                                              add_values += str(point_value['value']) + "), "
                                              trend_value_count += 1
                      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/shopfloorcost.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/spaceincome.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_output_category.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 analog_value_latest_dict.get(row_point[0]) is not None:
                                                            load_power_point_value = analog_value_latest_dict.get(row_point[0])['actual_value']
                                
                                
                                Severity: Major
                                Found in myems-api/reports/microgridlist.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/spacecarbon.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/storeenergyitem.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if row_datetime[0] + timedelta(minutes=10) > datetime.utcnow():
                                                                  is_online = True
                                      
                                      
                                      Severity: Major
                                      Found in myems-api/reports/energystoragepowerstationdashboard.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
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language