From: Jérôme Benoit Date: Wed, 15 Jul 2026 16:56:37 +0000 (+0200) Subject: style: codebase consistency sweep — JSDoc @returns backticks + != null idiom (#2009) X-Git-Tag: cli@v4.11.0~29 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0fdfaddffd571d4110849029cdf97bbf1d0309cf;p=e-mobility-charging-stations-simulator.git style: codebase consistency sweep — JSDoc @returns backticks + != null idiom (#2009) Behavior-preserving codebase style-consistency sweep. Closes #1966. - Backtick 49 JSDoc @returns boolean literals across 17 files (lowercase True/False). - Align !== undefined -> != null on number|undefined guards in OCPP20IncomingRequestService.ts (13 tokens); conditional-spread inclusion guards preserved as !== undefined. - Extend != null idiom to OCPP20VariableManager min/max ternaries + presence guards and the negated EVSE guard. - Fix OCPP20AuthAdapter.validateConfiguration @returns (synchronous boolean; was falsely 'Promise resolving to'). Gap C (String(previousRequestId) -> .toString()) dropped: premise false — operand is number|undefined, .toString() would fail typecheck (TS18048); String() is the only behavior-preserving form. All gates green (format/typecheck/lint/build/test, fail=0). Reviewed across multiple multi-agent rounds with cross-validation. --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index cae04dd6..4897a667 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -832,7 +832,7 @@ export class ChargingStation extends EventEmitter { * @param reservationId - The reservation ID to check * @param idTag - Optional ID tag for user reservation check * @param connectorId - Optional connector ID to check availability - * @returns True if the connector can accept a reservation + * @returns `true` if the connector can accept a reservation */ public isConnectorReservable ( reservationId: number, diff --git a/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts b/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts index 475929fb..4b0e3310 100644 --- a/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts +++ b/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts @@ -329,7 +329,7 @@ export class OCPP20CertificateManager { * @param stationHashId - Charging station unique identifier * @param certificateHashData - Certificate hash data to check against stored CS certificates * @param hashAlgorithm - Optional hash algorithm override (defaults to certificateHashData.hashAlgorithm) - * @returns true if the hash matches a stored ChargingStationCertificate, false otherwise + * @returns `true` if the hash matches a stored ChargingStationCertificate, `false` otherwise */ public async isChargingStationCertificateHash ( stationHashId: string, @@ -443,7 +443,7 @@ export class OCPP20CertificateManager { /** * Validates PEM certificate format * @param pemData - PEM data to validate - * @returns true if valid PEM certificate format, false otherwise + * @returns `true` if valid PEM certificate format, `false` otherwise */ public validateCertificateFormat (pemData: unknown): boolean { if (pemData == null || typeof pemData !== 'string') { @@ -678,7 +678,7 @@ export class OCPP20CertificateManager { /** * Type guard to check if a charging station has a certificate manager * @param chargingStation - The charging station to check - * @returns true if the charging station has a certificate manager + * @returns `true` if the charging station has a certificate manager */ export function hasCertificateManager ( chargingStation: ChargingStation diff --git a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts index 8a60e568..55f1100a 100644 --- a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts @@ -2407,7 +2407,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService { logger.debug( - `${chargingStation.logPrefix()} ${moduleName}.handleRequestReset: Reset request received with type ${commandPayload.type}${commandPayload.evseId !== undefined ? ` for EVSE ${commandPayload.evseId.toString()}` : ''}` + `${chargingStation.logPrefix()} ${moduleName}.handleRequestReset: Reset request received with type ${commandPayload.type}${commandPayload.evseId != null ? ` for EVSE ${commandPayload.evseId.toString()}` : ''}` ) const { evseId, type } = commandPayload @@ -2445,7 +2445,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService 0) { + if (evseId != null && evseId > 0) { if (!chargingStation.hasEvses) { logger.warn( `${chargingStation.logPrefix()} ${moduleName}.handleRequestReset: Charging station does not support EVSE-specific reset` @@ -2477,7 +2477,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService 0 let evseHasActiveTransactions = false - if (evseId !== undefined && evseId > 0) { + if (evseId != null && evseId > 0) { const evse = chargingStation.getEvseStatus(evseId) if (evse != null) { evseHasActiveTransactions = this.hasEvseActiveTransactions(evse) @@ -2486,7 +2486,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService 0) { + if (evseId != null && evseId > 0) { if (evseHasActiveTransactions) { logger.info( `${chargingStation.logPrefix()} ${moduleName}.handleRequestReset: Immediate EVSE reset with active transaction, will terminate transaction and reset EVSE ${evseId.toString()}` @@ -2555,7 +2555,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService 0) { + if (evseId != null && evseId > 0) { const evse = chargingStation.getEvseStatus(evseId) if (evse != null && !this.isEvseIdle(chargingStation, evse)) { logger.info( @@ -3067,7 +3067,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService void ): void { - if (evse?.id !== undefined && evse.id > 0 && evse.connectorId !== undefined) { + if (evse?.id != null && evse.id > 0 && evse.connectorId != null) { const evseStatus = chargingStation.getEvseStatus(evse.id) const connectorStatus = evseStatus?.connectors.get(evse.connectorId) const resolvedStatus = connectorStatus?.status ?? ConnectorStatusEnum.Available @@ -4456,7 +4456,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService 3) { logger.warn( `${chargingStation.logPrefix()} ${moduleName}.validateChargingSchedule: Period ${periodIndex.toString()} number of phases must be 1-3` @@ -4631,7 +4631,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService period.numberPhases) ) { logger.warn( @@ -4652,7 +4652,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService convertToIntOrNaN(currentMax)) { return this.rejectSet( variable, @@ -836,7 +836,7 @@ export class OCPP20VariableManager { } else { const currentMin = this.getMinSetOverrides(stationId).get(variableKey) ?? - (variableMetadata.min !== undefined ? variableMetadata.min.toString() : undefined) + (variableMetadata.min != null ? variableMetadata.min.toString() : undefined) if (currentMin != null && intValue < convertToIntOrNaN(currentMin)) { return this.rejectSet( variable, diff --git a/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts b/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts index f6a89be3..76369304 100644 --- a/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts +++ b/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts @@ -2594,7 +2594,7 @@ export function getVariableMetadata ( /** * Check if variable metadata is persistent. * @param variableMetadata - Variable metadata entry. - * @returns True when persistence is Persistent. + * @returns `true` when persistence is Persistent. */ export function isPersistent (variableMetadata: VariableMetadata): boolean { return variableMetadata.persistence === PersistenceEnumType.Persistent @@ -2603,7 +2603,7 @@ export function isPersistent (variableMetadata: VariableMetadata): boolean { /** * Check if variable metadata is read-only. * @param variableMetadata - Variable metadata entry. - * @returns True when mutability is ReadOnly. + * @returns `true` when mutability is ReadOnly. */ export function isReadOnly (variableMetadata: VariableMetadata): boolean { return variableMetadata.mutability === MutabilityEnumType.ReadOnly @@ -2612,7 +2612,7 @@ export function isReadOnly (variableMetadata: VariableMetadata): boolean { /** * Check if variable metadata is write-only. * @param variableMetadata - Variable metadata entry. - * @returns True when mutability is WriteOnly. + * @returns `true` when mutability is WriteOnly. */ export function isWriteOnly (variableMetadata: VariableMetadata): boolean { return variableMetadata.mutability === MutabilityEnumType.WriteOnly diff --git a/src/charging-station/ocpp/2.0/__testable__/OCPP20VariableManagerTestable.ts b/src/charging-station/ocpp/2.0/__testable__/OCPP20VariableManagerTestable.ts index 28feea74..1e871732 100644 --- a/src/charging-station/ocpp/2.0/__testable__/OCPP20VariableManagerTestable.ts +++ b/src/charging-station/ocpp/2.0/__testable__/OCPP20VariableManagerTestable.ts @@ -28,7 +28,7 @@ export interface TestableOCPP20VariableManager { * Validates whether a component is supported by the charging station. * @param chargingStation - The charging station instance * @param component - The component to validate - * @returns true if the component is valid/supported + * @returns `true` if the component is valid/supported */ isComponentValid: (chargingStation: ChargingStation, component: ComponentType) => boolean @@ -36,7 +36,7 @@ export interface TestableOCPP20VariableManager { * Checks whether a variable is supported for the given component. * @param component - The component containing the variable * @param variable - The variable to check - * @returns true if the variable is supported + * @returns `true` if the variable is supported */ isVariableSupported: (component: ComponentType, variable: VariableType) => boolean } diff --git a/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts b/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts index 6dcb8df5..c611a576 100644 --- a/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts +++ b/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts @@ -293,7 +293,7 @@ export class OCPP16AuthAdapter implements OCPPAuthAdapter { /** * Check if remote authorization is available - * @returns True if remote authorization is enabled and station is online + * @returns `true` if remote authorization is enabled and station is online */ isRemoteAvailable (): boolean { try { @@ -316,7 +316,7 @@ export class OCPP16AuthAdapter implements OCPPAuthAdapter { /** * Check if identifier is valid for OCPP 1.6 * @param identifier - Identifier to validate - * @returns True if identifier has valid ID_TAG type and length within OCPP 1.6 limits + * @returns `true` if identifier has valid ID_TAG type and length within OCPP 1.6 limits */ isValidIdentifier (identifier: Identifier): boolean { // OCPP 1.6 idTag validation @@ -340,7 +340,7 @@ export class OCPP16AuthAdapter implements OCPPAuthAdapter { /** * Validate adapter configuration for OCPP 1.6 * @param config - Auth configuration to validate - * @returns True if configuration has valid auth methods and timeout values + * @returns `true` if configuration has valid auth methods and timeout values */ validateConfiguration (config: AuthConfiguration): boolean { try { @@ -375,7 +375,7 @@ export class OCPP16AuthAdapter implements OCPPAuthAdapter { /** * Check if offline transactions are allowed for unknown IDs - * @returns True if offline transactions are allowed for unknown IDs + * @returns `true` if offline transactions are allowed for unknown IDs */ private getOfflineTransactionConfig (): boolean { try { diff --git a/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts b/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts index f5f98d56..51c796bc 100644 --- a/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts +++ b/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts @@ -368,7 +368,7 @@ export class OCPP20AuthAdapter implements OCPPAuthAdapter { /** * Check if remote authorization is available for OCPP 2.0.1 - * @returns True if remote authorization is available and enabled + * @returns `true` if remote authorization is available and enabled */ isRemoteAvailable (): boolean { try { @@ -392,7 +392,7 @@ export class OCPP20AuthAdapter implements OCPPAuthAdapter { /** * Check if identifier is valid for OCPP 2.0.1 * @param identifier - Identifier to validate against OCPP 2.0.1 rules - * @returns True if identifier meets OCPP 2.0.1 format requirements (max 36 chars, valid type) + * @returns `true` if identifier meets OCPP 2.0.1 format requirements (max 36 chars, valid type) */ isValidIdentifier (identifier: Identifier): boolean { // OCPP 2.0.1 idToken validation @@ -424,7 +424,7 @@ export class OCPP20AuthAdapter implements OCPPAuthAdapter { /** * Validate adapter configuration for OCPP 2.0.1 * @param config - Authentication configuration to validate - * @returns Promise resolving to true if configuration is valid for OCPP 2.0.1 operations + * @returns `true` if configuration is valid for OCPP 2.0.1 operations */ validateConfiguration (config: AuthConfiguration): boolean { try { @@ -460,7 +460,7 @@ export class OCPP20AuthAdapter implements OCPPAuthAdapter { /** * Check if offline authorization is allowed - * @returns True if offline authorization is enabled + * @returns `true` if offline authorization is enabled */ private getOfflineAuthorizationConfig (): boolean { try { diff --git a/src/charging-station/ocpp/auth/cache/InMemoryAuthCache.ts b/src/charging-station/ocpp/auth/cache/InMemoryAuthCache.ts index 9f78ed4e..29c1f5d7 100644 --- a/src/charging-station/ocpp/auth/cache/InMemoryAuthCache.ts +++ b/src/charging-station/ocpp/auth/cache/InMemoryAuthCache.ts @@ -371,7 +371,7 @@ export class InMemoryAuthCache implements AuthCache { /** * Check if identifier has exceeded rate limit * @param identifier - Identifier to check - * @returns true if within rate limit, false if exceeded + * @returns `true` if within rate limit, `false` if exceeded */ private checkRateLimit (identifier: string): boolean { if (!this.rateLimit.enabled) { diff --git a/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts b/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts index 5e184bbb..3d80b236 100644 --- a/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts +++ b/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts @@ -136,7 +136,7 @@ export interface AuthStrategy { * Check if this strategy can handle the given request * @param request - Authentication request * @param config - Current configuration - * @returns True if strategy can handle the request + * @returns `true` if strategy can handle the request */ canHandle(request: AuthRequest, config: AuthConfiguration): boolean diff --git a/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts b/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts index 11d0f1d8..aec52fda 100644 --- a/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts +++ b/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts @@ -428,7 +428,7 @@ export class OCPPAuthServiceImpl implements OCPPAuthService { /** * Check if authentication is supported for given identifier type * @param identifier - Identifier to check for support - * @returns True if at least one strategy can handle the identifier type, false otherwise + * @returns `true` if at least one strategy can handle the identifier type, `false` otherwise */ public isSupported (identifier: Identifier): boolean { const testRequest: AuthRequest = { @@ -447,7 +447,7 @@ export class OCPPAuthServiceImpl implements OCPPAuthService { /** * Test connectivity to remote authorization service - * @returns True if remote authorization service is reachable + * @returns `true` if remote authorization service is reachable */ public testConnectivity (): boolean { const remoteStrategy = this.strategies.get('remote') @@ -645,7 +645,7 @@ export class OCPPAuthServiceImpl implements OCPPAuthService { /** * Check if an error should stop the authentication chain * @param error - Error to evaluate for criticality - * @returns True if the error should halt authentication attempts, false to continue trying other strategies + * @returns `true` if the error should halt authentication attempts, `false` to continue trying other strategies */ private isCriticalError (error: Error): boolean { // Critical errors that should stop trying other strategies diff --git a/src/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.ts b/src/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.ts index fffc94e0..5cfc278e 100644 --- a/src/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.ts +++ b/src/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.ts @@ -106,7 +106,7 @@ export class CertificateAuthStrategy implements AuthStrategy { * Check if this strategy can handle the given request * @param request - Authorization request to evaluate for certificate-based handling * @param config - Authentication configuration with certificate settings - * @returns True if the request contains valid certificate data and certificate auth is enabled + * @returns `true` if the request contains valid certificate data and certificate auth is enabled */ canHandle (request: AuthRequest, config: AuthConfiguration): boolean { // Only handle certificate-based authentication @@ -205,7 +205,7 @@ export class CertificateAuthStrategy implements AuthStrategy { /** * Check if the identifier contains certificate data * @param identifier - Identifier to check for certificate hash data - * @returns True if all required certificate hash fields are present and non-empty + * @returns `true` if all required certificate hash fields are present and non-empty */ private hasCertificateData (identifier: Identifier): boolean { const certData = identifier.certificateHashData @@ -223,7 +223,7 @@ export class CertificateAuthStrategy implements AuthStrategy { * Simulate certificate validation (in real implementation, this would involve crypto operations) * @param request - Authorization request containing certificate data to validate * @param config - Authentication configuration with validation strictness settings - * @returns True if the certificate passes simulated validation checks + * @returns `true` if the certificate passes simulated validation checks */ private async simulateCertificateValidation ( request: AuthRequest, diff --git a/src/charging-station/ocpp/auth/strategies/LocalAuthStrategy.ts b/src/charging-station/ocpp/auth/strategies/LocalAuthStrategy.ts index 28c85c88..95766b7c 100644 --- a/src/charging-station/ocpp/auth/strategies/LocalAuthStrategy.ts +++ b/src/charging-station/ocpp/auth/strategies/LocalAuthStrategy.ts @@ -175,7 +175,7 @@ export class LocalAuthStrategy implements AuthStrategy { * Check if this strategy can handle the authentication request * @param request - Authorization request to evaluate * @param config - Authentication configuration with local auth settings - * @returns True if local list, cache, or offline authorization is enabled + * @returns `true` if local list, cache, or offline authorization is enabled */ public canHandle (request: AuthRequest, config: AuthConfiguration): boolean { // Can handle if local list is enabled OR cache is enabled OR offline is allowed @@ -299,7 +299,7 @@ export class LocalAuthStrategy implements AuthStrategy { /** * Check if identifier is in local authorization list * @param identifier - Unique identifier string to look up - * @returns True if the identifier exists in the local authorization list + * @returns `true` if the identifier exists in the local authorization list */ public isInLocalList (identifier: string): boolean { if (!this.localAuthListManager) { @@ -510,7 +510,7 @@ export class LocalAuthStrategy implements AuthStrategy { * When DisablePostAuthorize is true or not configured, local results are returned as-is. * @param result - Authorization result from cache or local list * @param config - Authentication configuration with disablePostAuthorize setting - * @returns True if the result should be discarded to trigger remote re-authorization + * @returns `true` if the result should be discarded to trigger remote re-authorization */ private shouldTriggerPostAuthorize ( result: AuthorizationResult, diff --git a/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts b/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts index d8bf79d1..651b033a 100644 --- a/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts +++ b/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts @@ -185,7 +185,7 @@ export class RemoteAuthStrategy implements AuthStrategy { * Check if this strategy can handle the authentication request * @param request - Authorization request to evaluate * @param config - Authentication configuration with remote authorization settings - * @returns True if an adapter is available and remote auth is enabled + * @returns `true` if an adapter is available and remote auth is enabled */ public canHandle (request: AuthRequest, config: AuthConfiguration): boolean { // Can handle if we have an adapter @@ -341,7 +341,7 @@ export class RemoteAuthStrategy implements AuthStrategy { /** * Test connectivity to remote authorization service - * @returns True if the OCPP adapter can reach its remote service + * @returns `true` if the OCPP adapter can reach its remote service */ public testConnectivity (): boolean { if (!this.isInitialized || this.adapter == null) { @@ -399,7 +399,7 @@ export class RemoteAuthStrategy implements AuthStrategy { * Check if remote authorization service is available * @param adapter - OCPP adapter to check for remote service availability * @param _config - Authentication configuration (unused) - * @returns True if the remote service responds + * @returns `true` if the remote service responds */ private checkRemoteAvailability (adapter: OCPPAuthAdapter, _config: AuthConfiguration): boolean { try { diff --git a/src/charging-station/ocpp/auth/types/AuthTypes.ts b/src/charging-station/ocpp/auth/types/AuthTypes.ts index 8e102f3c..db59df06 100644 --- a/src/charging-station/ocpp/auth/types/AuthTypes.ts +++ b/src/charging-station/ocpp/auth/types/AuthTypes.ts @@ -310,7 +310,7 @@ export class AuthenticationError extends Error { /** * Check if identifier type is certificate-based * @param type - Identifier type to check - * @returns True if certificate-based + * @returns `true` if certificate-based */ export const isCertificateBased = (type: IdentifierType): boolean => { return type === IdentifierType.CERTIFICATE @@ -319,7 +319,7 @@ export const isCertificateBased = (type: IdentifierType): boolean => { /** * Check if identifier type is OCPP 1.6 compatible * @param type - Identifier type to check - * @returns True if OCPP 1.6 type + * @returns `true` if OCPP 1.6 type */ export const isOCPP16Type = (type: IdentifierType): boolean => { return type === IdentifierType.ID_TAG @@ -328,7 +328,7 @@ export const isOCPP16Type = (type: IdentifierType): boolean => { /** * Check if identifier type is OCPP 2.0.1 compatible * @param type - Identifier type to check - * @returns True if OCPP 2.0.1 type + * @returns `true` if OCPP 2.0.1 type */ export const isOCPP20Type = (type: IdentifierType): boolean => { return (Object.values(OCPP20IdTokenEnumType) as string[]).includes(type) @@ -337,7 +337,7 @@ export const isOCPP20Type = (type: IdentifierType): boolean => { /** * Check if identifier type requires additional information * @param type - Identifier type to check - * @returns True if additional info is required + * @returns `true` if additional info is required */ export const requiresAdditionalInfo = (type: IdentifierType): boolean => { return [ diff --git a/src/charging-station/ocpp/auth/utils/AuthHelpers.ts b/src/charging-station/ocpp/auth/utils/AuthHelpers.ts index 1579b62a..b49ced81 100644 --- a/src/charging-station/ocpp/auth/utils/AuthHelpers.ts +++ b/src/charging-station/ocpp/auth/utils/AuthHelpers.ts @@ -118,7 +118,7 @@ function getStatusMessage (status: AuthorizationStatus): string { /** * Check whether an authorization result represents a permanent failure. * @param result - Authorization result to evaluate - * @returns True if BLOCKED, EXPIRED, or INVALID + * @returns `true` if BLOCKED, EXPIRED, or INVALID */ function isPermanentFailure (result: AuthorizationResult): boolean { return [ @@ -131,7 +131,7 @@ function isPermanentFailure (result: AuthorizationResult): boolean { /** * Check whether an authorization result is still valid (ACCEPTED and not expired). * @param result - Authorization result to evaluate - * @returns True if ACCEPTED and expiry date has not passed + * @returns `true` if ACCEPTED and expiry date has not passed */ function isResultValid (result: AuthorizationResult): boolean { if (result.status !== AuthorizationStatus.ACCEPTED) { @@ -149,7 +149,7 @@ function isResultValid (result: AuthorizationResult): boolean { /** * Check whether an authorization result represents a temporary failure. * @param result - Authorization result to evaluate - * @returns True if PENDING or UNKNOWN + * @returns `true` if PENDING or UNKNOWN */ function isTemporaryFailure (result: AuthorizationResult): boolean { if (result.status === AuthorizationStatus.PENDING) { diff --git a/src/charging-station/ocpp/auth/utils/AuthValidators.ts b/src/charging-station/ocpp/auth/utils/AuthValidators.ts index c4afa98d..5f7690f1 100644 --- a/src/charging-station/ocpp/auth/utils/AuthValidators.ts +++ b/src/charging-station/ocpp/auth/utils/AuthValidators.ts @@ -23,7 +23,7 @@ const MAX_IDTOKEN_LENGTH = 36 /** * Validate cache TTL value * @param ttl - Cache time-to-live duration in seconds, or undefined for optional parameter - * @returns True if the TTL is undefined or a valid non-negative finite number, false otherwise + * @returns `true` if the TTL is undefined or a valid non-negative finite number, `false` otherwise */ function isValidCacheTTL (ttl: number | undefined): boolean { if (ttl === undefined) { @@ -36,7 +36,7 @@ function isValidCacheTTL (ttl: number | undefined): boolean { /** * Validate connector ID * @param connectorId - Charging connector identifier (0 or positive integer), or undefined for optional parameter - * @returns True if the connector ID is undefined or a valid non-negative integer, false otherwise + * @returns `true` if the connector ID is undefined or a valid non-negative integer, `false` otherwise */ function isValidConnectorId (connectorId: number | undefined): boolean { if (connectorId === undefined) { @@ -49,7 +49,7 @@ function isValidConnectorId (connectorId: number | undefined): boolean { /** * Validate that a string is a valid identifier value * @param value - Authentication identifier string to validate (idTag or IdToken value) - * @returns True if the value is a non-empty string with at least one non-whitespace character, false otherwise + * @returns `true` if the value is a non-empty string with at least one non-whitespace character, `false` otherwise */ function isValidIdentifierValue (value: string): boolean { return isNotEmptyString(value) @@ -90,7 +90,7 @@ function sanitizeIdToken (idToken: unknown): string { /** * Validate authentication configuration * @param config - Authentication configuration object to validate (may be any type) - * @returns True if the configuration has valid required fields and constraints, false otherwise + * @returns `true` if the configuration has valid required fields and constraints, `false` otherwise */ function validateAuthConfiguration (config: unknown): boolean { if (!config || typeof config !== 'object') { @@ -144,7 +144,7 @@ function validateAuthConfiguration (config: unknown): boolean { /** * Validate identifier format and constraints * @param identifier - Identifier object to validate (may be any type) - * @returns True if the identifier has a valid type and value within OCPP length constraints, false otherwise + * @returns `true` if the identifier has a valid type and value within OCPP length constraints, `false` otherwise */ function validateIdentifier (identifier: unknown): boolean { // Check if identifier itself is valid diff --git a/src/utils/ConfigurationMigrations.ts b/src/utils/ConfigurationMigrations.ts index 357cf029..548125fa 100644 --- a/src/utils/ConfigurationMigrations.ts +++ b/src/utils/ConfigurationMigrations.ts @@ -126,7 +126,7 @@ const deleteAtPath = (target: Record, path: string): void => { * @param value - value to write at the leaf * @param source - originating deprecated key (for error messages) * @param fieldErrors - error accumulator - * @returns true on write or no-op, false when an error is recorded + * @returns `true` on write or no-op, `false` when an error is recorded */ const setAtPath = ( target: Record,