-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclang-format.mjs
More file actions
25 lines (19 loc) · 725 Bytes
/
clang-format.mjs
File metadata and controls
25 lines (19 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import child_process from 'child_process';
const args = ['--Werror', '-i', '--style=file', 'module.cc'];
try {
child_process.execFileSync('./node_modules/.bin/clang-format', args, {stdio: 'inherit'});
} catch (e) {
// This fails on linux_arm64
// eslint-disable-next-line no-console
console.log('Running clang format command failed.');
}
// eslint-disable-next-line no-console
console.log('clang-format: done, checking tree...');
const diff = child_process.execSync('git status --short').toString();
if (diff) {
// eslint-disable-next-line no-console
console.error('clang-format: check failed ❌');
process.exit(1);
}
// eslint-disable-next-line no-console
console.log('clang-format: check passed ✅');