chore: check shell scripts in lint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SfihHazrSHXgndJtSNLubJ
This commit is contained in:
Tony Averty 2026-10-21 15:06:32 +02:00
parent 24a6ea1ee1
commit 49b2c17f0c
No known key found for this signature in database

View file

@ -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);