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:
parent
24a6ea1ee1
commit
49b2c17f0c
1 changed files with 13 additions and 1 deletions
|
|
@ -19,5 +19,17 @@ for (const f of files) {
|
||||||
try { execFileSync(process.execPath, ['--check', f], { stdio: 'pipe' }); }
|
try { execFileSync(process.execPath, ['--check', f], { stdio: 'pipe' }); }
|
||||||
catch (e) { failed++; console.error(`✗ ${f}\n${e.stderr}`); }
|
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);
|
process.exit(failed ? 1 : 0);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue