From: Jérôme Benoit Date: Sun, 4 Apr 2021 20:13:11 +0000 (+0200) Subject: Linter fixes. X-Git-Tag: v1.0.1-0~63 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=035742f7433c00edbd0259966e7af6a1cfa2f0a1;p=e-mobility-charging-stations-simulator.git Linter fixes. Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 763533ed..bb8d75b3 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -46,7 +46,8 @@ export default class AutomaticTransactionGenerator { const transactionId = this.chargingStation.getConnector(Utils.convertToInt(connector)).transactionId; if (this.chargingStation.getConnector(Utils.convertToInt(connector)).transactionStarted) { logger.info(this.logPrefix(Utils.convertToInt(connector)) + ' ATG OVER. Stop transaction ' + transactionId.toString()); - await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId), reason); + await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), + this.chargingStation.getTransactionIdTag(transactionId), reason); } } this.timeToStop = true; diff --git a/src/charging-station/ocpp/1.6/OCCP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCCP16IncomingRequestService.ts index 0f7e4dab..5a41771d 100644 --- a/src/charging-station/ocpp/1.6/OCCP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCCP16IncomingRequestService.ts @@ -62,7 +62,8 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer } if (this.chargingStation.getConnector(connectorId)?.transactionStarted) { const transactionId = this.chargingStation.getConnector(connectorId).transactionId; - const stopResponse = await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId), OCPP16StopTransactionReason.UNLOCK_COMMAND); + const stopResponse = await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), + this.chargingStation.getTransactionIdTag(transactionId), OCPP16StopTransactionReason.UNLOCK_COMMAND); if (stopResponse.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) { return Constants.OCPP_RESPONSE_UNLOCKED; } @@ -295,7 +296,8 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer if (Utils.convertToInt(connector) > 0 && this.chargingStation.getConnector(Utils.convertToInt(connector))?.transactionId === transactionId) { await this.chargingStation.ocppRequestService.sendStatusNotification(Utils.convertToInt(connector), OCPP16ChargePointStatus.FINISHING); this.chargingStation.getConnector(Utils.convertToInt(connector)).status = OCPP16ChargePointStatus.FINISHING; - await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId)); + await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), + this.chargingStation.getTransactionIdTag(transactionId)); return Constants.OCPP_RESPONSE_ACCEPTED; } } diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 7470b342..4e828453 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -45,7 +45,8 @@ export default class OCPP16RequestService extends OCPPRequestService { } } - public async sendStatusNotification(connectorId: number, status: OCPP16ChargePointStatus, errorCode: OCPP16ChargePointErrorCode = OCPP16ChargePointErrorCode.NO_ERROR): Promise { + public async sendStatusNotification(connectorId: number, status: OCPP16ChargePointStatus, + errorCode: OCPP16ChargePointErrorCode = OCPP16ChargePointErrorCode.NO_ERROR): Promise { try { const payload: StatusNotificationRequest = { connectorId, @@ -83,7 +84,8 @@ export default class OCPP16RequestService extends OCPPRequestService { } } - public async sendStopTransaction(transactionId: number, meterStop: number, idTag?: string, reason: OCPP16StopTransactionReason = OCPP16StopTransactionReason.NONE): Promise { + public async sendStopTransaction(transactionId: number, meterStop: number, idTag?: string, + reason: OCPP16StopTransactionReason = OCPP16StopTransactionReason.NONE): Promise { try { const payload: StopTransactionRequest = { transactionId, diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 2c2a8a5b..290316cc 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -21,7 +21,8 @@ export default abstract class OCPPRequestService { this.ocppResponseService = ocppResponseService; } - public async sendMessage(messageId: string, commandParams: any, messageType: MessageType = MessageType.CALL_RESULT_MESSAGE, commandName: RequestCommand | IncomingRequestCommand): Promise { + public async sendMessage(messageId: string, commandParams: any, messageType: MessageType = MessageType.CALL_RESULT_MESSAGE, + commandName: RequestCommand | IncomingRequestCommand): Promise { // eslint-disable-next-line @typescript-eslint/no-this-alias const self = this; // Send a message through wsConnection diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 1a0d7b70..e4bc6a7b 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -104,14 +104,14 @@ export default class Utils { return Math.floor(Math.random() * max + 1); } - static roundTo(number: number, scale: number): number { + static roundTo(numberValue: number, scale: number): number { const roundPower = Math.pow(10, scale); - return Math.round(number * roundPower) / roundPower; + return Math.round(numberValue * roundPower) / roundPower; } - static truncTo(number: number, scale: number): number { + static truncTo(numberValue: number, scale: number): number { const truncPower = Math.pow(10, scale); - return Math.trunc(number * truncPower) / truncPower; + return Math.trunc(numberValue * truncPower) / truncPower; } static getRandomFloatRounded(max: number, min = 0, scale = 2): number {