From 49b2c17f0c80fbec369c7559cbdea0e3c4308b79 Mon Sep 17 00:00:00 2001 From: Tony Averty Date: Wed, 21 Oct 2026 15:06:32 +0200 Subject: [PATCH] chore: check shell scripts in lint Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SfihHazrSHXgndJtSNLubJ --- scripts/check-syntax.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/check-syntax.js b/scripts/check-syntax.js index d867059..c0ee2fd 100644 --- a/scripts/check-syntax.js +++ b/scripts/check-syntax.js @@ -19,5 +19,17 @@ for (const f of files) { try { execFileSync(process.execPath, ['--check', f], { stdio: 'pipe' }); } catch (e) { failed++; console.error(`✗ ${f}\n${e.stderr}`); } } -console.log(`${files.length - failed}/${files.length} fichiers OK`); +// Scripts shell : syntaxe bash, + shellcheck s'il est installé +const shells = ['install.sh', 'deploy/aitools-backup.sh', '.githooks/pre-commit']; +let hasShellcheck = true; +try { execFileSync('shellcheck', ['--version'], { stdio: 'pipe' }); } catch { hasShellcheck = false; } +for (const f of shells) { + try { + execFileSync('bash', ['-n', f], { stdio: 'pipe' }); + if (hasShellcheck) execFileSync('shellcheck', ['-S', 'warning', '-x', f], { stdio: 'pipe' }); + } catch (e) { failed++; console.error(`✗ ${f}\n${e.stdout || ''}${e.stderr || ''}`); } +} + +const total = files.length + shells.length; +console.log(`${total - failed}/${total} fichiers OK${hasShellcheck ? '' : ' (shellcheck absent, syntaxe bash seulement)'}`); process.exit(failed ? 1 : 0);