Production/scripts/code_quality/check_has_access_safety.ts
Ce check verifie la securite d'utilisation de hasAccess(...) dans le code.
Objectif:
await sur un appel asynchrone.bigint a hasAccess.Le check parcourt les fichiers source (apps et packages) et applique 2 regles:
hasAccess(...) doit etre precede de await.hasAccess(...) ne doivent pas contenir de bigint.Detection bigint (statique):
123n,BigInt(...),as bigint,: bigint,bigint passes en argument.Commande standard (depuis le dossier AM):
npm run check:has-access-safety
[check:has-access-safety] Starting hasAccess safety validation
Project root: /mnt/data/vmenon/Other_Work/efrei-dev/AM
Rules: every hasAccess(...) call must be awaited and must not receive bigint values.
Source files to scan: 267
[OK] hasAccess usage is safe (0.02s).
[FAIL] hasAccess safety violations detected.
apps/bots/avenir-rider/src/commands/example.ts:42 -> hasAccess(...) call is missing await
apps/bots/avenir-rider/src/commands/example.ts:73 -> hasAccess(...) receives a possible bigint value
Troubleshooting:
- Await every hasAccess(...) call: const allowed = await hasAccess(...)
- Convert Discord IDs to string before hasAccess(...) when needed.
- Avoid bigint literals or BigInt(...) values in hasAccess arguments.
- Re-run: npm run check:has-access-safety
Summary: 2 violation(s) found in 0.02s.
await devant chaque appel hasAccess(...).string avant l appel si necessaire.bigint dans les objets subject et options passes a hasAccess.hasAccess respectent les regles de securite attendues.